angular7

Upgrade angular 4 to 7 @angular/http to @angular/common/http

大憨熊 提交于 2019-12-22 10:53:16
问题 Currently, I am upgrading my Angular project4 using webpack to Angular7. I stuck in one step Switch from HttpModule and the Http service to HttpClientModule and the HttpClient service. HttpClient simplifies the default ergonomics (You don't need to map to json anymore) and now supports typed return values and interceptors. About this step I need to replace from rom HttpModule and Http to HttpClientModule and HttpClient . Update from Http to HttpClient , are there any script to help like $rxjs

How to display the table headers in a row, in angular material table?

守給你的承諾、 提交于 2019-12-22 10:28:00
问题 My Material table displays the value in below manner: Name |quatity Mango|10 <div class="table-cover center-table"> <div class="mat-elevation-z8 elevation-scroll-control"> <table mat-table class="full-width-table left-margin" [dataSource]="dataSource" matSort aria-label="Elements"> <!-- Name Column --> <ng-container matColumnDef="name"> <td mat-header-cell *matHeaderCellDef >Name</td> <td mat-cell *matCellDef="let row" class=""> <div class="cell-style padding-left">{{row.Name}}</div> </td> <

How to downgrade angular7 to angular6

半腔热情 提交于 2019-12-22 09:47:49
问题 I have tried to downgrade angular 7 to angular 6 by running the following npm commands: npm uninstall -g angular-cli npm cache clean npm install -g angular-cli@6.1.1 However angular/cli 7 version is still displaying in my package.json file. I need help to downgrade angular7 to angular6 . 回答1: You need to set the version numbers in your package.json for (at least) this packages "@angular/animations": "^7.0.0", "@angular/cdk": "7.3.3", "@angular/common": "^7.0.0", "@angular/compiler": "7.2.6",

How to fix “ Property 'wheelDelta' does not exist on type 'WheelEvent' ” while upgrading to angular 7,rxjs6?

大城市里の小女人 提交于 2019-12-22 08:39:33
问题 I'm upgrading to angular7 with rxjs6: in mouseWheelEvent type I am getting "Property 'wheelDelta' does not exist on type 'WheelEvent'" . Do we have any alternative for wheelDelta ? mouseWheelFunc(event: MouseWheelEvent): void { // var event = window.event || event; // old IE support let delta = Math.max(-1, Math.min(1, (event.wheelDelta || -event.detail))); if ( delta > 0) { this.mouseWheelUp.emit(event); } else if ( delta < 0) { this.mouseWheelDown.emit(event); } // for IE event.returnValue

Angular build for production fails

半腔热情 提交于 2019-12-22 01:43:18
问题 When I try to build for production my angular application with the following command ng build --prod --build-optimizer I get the following output: Date: 2019-01-29T08:39:12.193Z Hash: 05648c76cf91b1245f68 Time: 27920ms chunk {0} runtime.1eee2a92f0ed121267d0.js (runtime) 2.22 kB [entry] [rendered] chunk {1} 1.71c6b320e46d84e7f880.js () 88.8 kB [rendered] chunk {2} main.058aa675d38205a01c2e.js (main) 1.65 MB [initial] [rendered] chunk {3} polyfills.6226af78bf8dfb509e3e.js (polyfills) 61.7 kB

Angular 7 PWA + Azure Functions Gateway Timeout 504 only with Https

霸气de小男生 提交于 2019-12-21 13:08:48
问题 So the title pretty much says it all! I have an Angular 7 app compiled as PWA my package.json is below. My backend api is written in AzureFunctions V2. "dependencies": { "@angular-devkit/core": "^7.0.5", "@angular/animations": "^7.0.3", "@angular/cdk": "^7.0.3", "@angular/common": "^7.0.3", "@angular/compiler": "^7.0.3", "@angular/core": "^7.0.3", "@angular/flex-layout": "^7.0.0-beta.19", "@angular/forms": "^7.0.3", "@angular/http": "^7.0.3", "@angular/material": "^7.0.3", "@angular/platform

Angular 7: Clear selection with x-button on a dropdown box

拜拜、爱过 提交于 2019-12-21 12:10:20
问题 I thought I can combine the examples from Angular for dropdown and the Input with clear box to: <mat-form-field > <mat-select placeholder="Country" [(value)]="selectedCountry" (selectionChange)="emitItemChanges()"> <div *ngFor="let item of lstItems|async"> <mat-option *ngIf="addItem(item)" [value]="item">{{item.title}}</mat-option> </div> </mat-select> <button mat-button *ngIf="selectedCountry" matSuffix mat-icon-button aria-label="Clear" (click)="selectedCountry=undefined"> <mat-icon>close<

net::ERR_INVALID_HTTP_RESPONSE error after post request with Angular 7

China☆狼群 提交于 2019-12-21 03:52:12
问题 I am working on small web application and I am using angular 7 and asp.net core web api as a back end. I am trying to make http post request with angular. My service returns string (token) and when I receive it, I want to show it in alert box. I have tested my service with Postman and everything works as expected. From the browser my request is successfully mapped to the controller's action method. I have set breakpoint in this method body and it successfully returns token without any problem

WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export 'ɵɵdefineInjectable' was not found in '@angular/core'

一曲冷凌霜 提交于 2019-12-20 17:53:08
问题 I am using ng2-charts in Angular 7 app and having warning WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export 'ɵɵdefineInjectable' was not found in '@angular/core' error in VS Code error in browser What could be the reason and how to resolve it? 回答1: ng2-charts v2.2.4 has this bug as lots of users are reporting that so down-grading to ng2-charts v2.2.3 is fine until it is fixed in the future releases. npm install ng2-charts@2.2.3 来源: https://stackoverflow.com/questions

How to wait till i get a response from backend spring boot api in angular 7

北战南征 提交于 2019-12-20 07:45:39
问题 I wanted to navigate from one route to another route with the result of http post method. But the navigation is happening without the response from http post. The response is getting later when i debugged the code How can i fix this ? is there any way to wait the execution till the response comes from backend ? when i click on a button, a function will execute and a http post call will happen then i need to pass the response from the post request to a new route Quiz.service.ts getResult