angular6

How to send Multiple Http request sequentially in Angular

北战南征 提交于 2020-01-25 10:10:32
问题 I have written below code to call an API each time before post request happens, First API gets called and the second one is not getting called public post(postUrl: string, model: any): Observable<any> { return this.validateTokenStatus().pipe(map(response => { console.log('response', response); // if (response) { console.log('response2', response); const url = `${environment.webApiUrl}/${postUrl}`; this.spinnerService.start(); console.log('response21', response); return this._http.post(url,

How to send Multiple Http request sequentially in Angular

心不动则不痛 提交于 2020-01-25 10:10:02
问题 I have written below code to call an API each time before post request happens, First API gets called and the second one is not getting called public post(postUrl: string, model: any): Observable<any> { return this.validateTokenStatus().pipe(map(response => { console.log('response', response); // if (response) { console.log('response2', response); const url = `${environment.webApiUrl}/${postUrl}`; this.spinnerService.start(); console.log('response21', response); return this._http.post(url,

how to trigger input onchange from Angular spec

情到浓时终转凉″ 提交于 2020-01-24 23:15:48
问题 I have an input HTML File filed <input type="file" class="custom-file-input" id="question-file-upload" formControlName="image" (change)="handleFileSelect($event)"> I want to unit test handleFileSelect function. But I don't know how to trigger the onChange method of the input. Following is the spec I have written but I get error imageInputNE.onchange is not a function fit('should keep track of image counter when an image is loaded', () => { let newPracticeQuestionComponent = component; expect

how to trigger input onchange from Angular spec

China☆狼群 提交于 2020-01-24 23:14:26
问题 I have an input HTML File filed <input type="file" class="custom-file-input" id="question-file-upload" formControlName="image" (change)="handleFileSelect($event)"> I want to unit test handleFileSelect function. But I don't know how to trigger the onChange method of the input. Following is the spec I have written but I get error imageInputNE.onchange is not a function fit('should keep track of image counter when an image is loaded', () => { let newPracticeQuestionComponent = component; expect

ERROR: Can't bind to 'dataSource' since it isn't a known property of 'mat-tree'

本小妞迷上赌 提交于 2020-01-24 01:49:10
问题 I added the example retrieved from https://material.angular.io/components/tree/overview (The example can be seen[https://stackblitz.com/angular/arbvompqpmg?file=main.ts]) the documentation but it throw this error: Can't bind to 'dataSource' since it isn't a known property of 'mat-tree'. 1. If 'mat-tree' is an Angular component and it has 'dataSource' input, then verify that it is part of this module. 2. If 'mat-tree' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule

Angular6 Error: Uncaught (in promise): Error: StaticInjectorError(o)[e -> e]

偶尔善良 提交于 2020-01-24 00:13:10
问题 I have Angular 6.0.3 in Production by using ng build --prod in command line project get build success but while running http-server on dist getting the following Exception in browser console ERROR Error: Uncaught (in promise): Error: StaticInjectorError(o)[e -> e]: StaticInjectorError(Platform: core)[e -> e]: NullInjectorError: No provider for e! Error: StaticInjectorError(o)[e -> e]: StaticInjectorError(Platform: core)[e -> e]: NullInjectorError: No provider for e! at e.get (main

Angular Module vs. Library

人走茶凉 提交于 2020-01-23 12:06:32
问题 So great, the Angular has released version 6 and the CLI provides an option to generate libraries - something that they call a "highly anticipated feature". Now, coming from a business perspective, I am wondering: why you would actually need this, why inside of an existing project and not a separate which you can install as usual via npm... and if you want this inside your project, why not use a module for that. So I get it, publish something on npmjs and hope the whole world and future

How to hide placeholder onclick in material

痞子三分冷 提交于 2020-01-23 04:41:04
问题 I am using simple form-field input component as in below code <mat-form-field class="example-form-field" > <input matInput type="search" placeholder="Search" > </mat-form-field> On entering the input fieled by default the placeholder will go above. How can i hide the placeholder on entering to the input field? 回答1: You can try: DEMO ----> Solution You can also create Directive for same You can replace (click) ----> (focus) as you need <mat-form-field floatLabel=never> <input (click)=

mat-filtering/mat-sort not work correctly when use ngif in mat-table parent

旧时模样 提交于 2020-01-22 12:04:18
问题 Note that paging/sort not work correctly. Paging does not show the number of elements it is showing and sorting does not work, but if you delete the line in the html file *ngIf="dataSource?.filteredData.length > 0" the error is fixed. If you use filtering, it works, but it does not show the filter amount Check the example. https://stackblitz.com/edit/angular-wqkekh-nm3pn2?file=app/table-pagination-example.html 回答1: In your component.ts, replace this code @ViewChild(MatPaginator) paginator:

mat-filtering/mat-sort not work correctly when use ngif in mat-table parent

亡梦爱人 提交于 2020-01-22 12:02:08
问题 Note that paging/sort not work correctly. Paging does not show the number of elements it is showing and sorting does not work, but if you delete the line in the html file *ngIf="dataSource?.filteredData.length > 0" the error is fixed. If you use filtering, it works, but it does not show the filter amount Check the example. https://stackblitz.com/edit/angular-wqkekh-nm3pn2?file=app/table-pagination-example.html 回答1: In your component.ts, replace this code @ViewChild(MatPaginator) paginator: