angular6

Is it good way to call subscribe inside subscribe?

隐身守侯 提交于 2019-11-27 05:46:04
问题 this.service.service1().subscribe( res1 => { this.service.service1().subscribe( res2 => { this.service.service1().subscribe( res3 => { this.funcA(res1, res2, res3); }); }); }); I need to pass three data to one function from three different API's. Is it a good practice to subscribe inside a subscribe? If not, Please suggest the best way. 回答1: The correct way is to compose the various observables in some manner then subscribe to the overall flow - how you compose them will depend on your exact

want to show more data in another component when view in detail button is clicked (angular 6)

喜夏-厌秋 提交于 2019-11-27 05:41:00
I am new to angular6, Please do not consider this question as duplicated, as i could not able to find relevant answer so far, I have 2 components incident Component and incident-detail component , (incident-detail component is inside incident component) I have fetched data from api in incident.component.ts now I have a button called view details in incident.component.html when clicked the view detail button it will navigate to incident-detail component using router.navigate , now along with this I want send data which is in incident component.ts to incident-detail component.ts so that I can

Angular 2/4/6/7 - Unit Testing with Router

半腔热情 提交于 2019-11-27 03:55:25
In Angular 2.0.0, I am unit testing a component that uses Router. However I get the 'Supplied parameters do not match any signature of call target.' error. In Visual studio code in spec.ts it is the new Router() that is highlighted in red I really appreciate if someone could let me know what the correct syntax would be? Thanks in advance. My code as follows: spec.ts import { TestBed, async } from '@angular/core/testing'; import { NavToolComponent } from './nav-tool.component'; import { ComponentComm } from '../../shared/component-comm.service'; import { Router } from '@angular/router';

How to use mat-autocomplete (Angular Material Autocomplete) inside FormArray (Reactive Forms)

旧城冷巷雨未停 提交于 2019-11-26 21:54:54
问题 let's say I have the following form structure: this.myForm = this.formBuilder.group({ date: ['', [Validators.required]], notes: [''], items: this.initItems() }); initItems() { var formArray = this.formBuilder.array([]); for (let i = 0; i < 2; i++) { formArray.push(this.formBuilder.group({ name: ['', [Validators.required]], age: ['', [Validators.required]], })); } return formArray; } and the name control supposed to be an autocomplete, how can I relate the all the name controls to an

Could not find module “@angular-devkit/build-angular”

北慕城南 提交于 2019-11-26 18:10:41
After updating to Angular 6.0.1, I get the following error on ng serve : Could not find module "@angular-devkit/build-angular" from "/home/Projects/myProjectName". Error: Could not find module "@angular-devkit/build-angular" from "/home/Projects/myProjectName". at Object.resolve (/home/Projects/myProjectName/node_modules/@angular-devkit/core/node/resolve.js:141:11) at Observable.rxjs_1.Observable [as _subscribe] (/home/Projects/myProjectName/node_modules/@angular-devkit/architect/src/architect.js:132:40) ng update says everything is in order. Deleting node_modules folder and a fresh npm

want to show more data in another component when view in detail button is clicked (angular 6)

微笑、不失礼 提交于 2019-11-26 11:42:18
问题 I am new to angular6, Please do not consider this question as duplicated, as i could not able to find relevant answer so far, I have 2 components incident Component and incident-detail component , (incident-detail component is inside incident component) I have fetched data from api in incident.component.ts now I have a button called view details in incident.component.html when clicked the view detail button it will navigate to incident-detail component using router.navigate , now along with

Upgrading to angular-6.x gives “Uncaught ReferenceError: global is not defined”

£可爱£侵袭症+ 提交于 2019-11-26 08:26:47
问题 I upgraded my project from angular-5.x to angular-6.x and it started giving the following error and even creation of dummy global variable does not work as given here Angular 6 Auth0 - global not defined The error is as follows: Uncaught ReferenceError: global is not defined at Object../node_modules/has-binary2/index.js (index.js:10) at __webpack_require__ (bootstrap:81) at Object../node_modules/socket.io-parser/index.js (index.js:8) at __webpack_require__ (bootstrap:81) at Object../node

Angular 2/4/6/7 - Unit Testing with Router

断了今生、忘了曾经 提交于 2019-11-26 08:10:29
问题 In Angular 2.0.0, I am unit testing a component that uses Router. However I get the \'Supplied parameters do not match any signature of call target.\' error. In Visual studio code in spec.ts it is the new Router() that is highlighted in red I really appreciate if someone could let me know what the correct syntax would be? Thanks in advance. My code as follows: spec.ts import { TestBed, async } from \'@angular/core/testing\'; import { NavToolComponent } from \'./nav-tool.component\'; import {

Angular-cli from css to scss

倖福魔咒の 提交于 2019-11-26 04:11:33
问题 I\'ve read the documentation, which says that if I want to use scss I have to run the following command: ng set defaults.styleExt scss But when I do that and make that file, I still receive this error in my console: styles.bundle.js:33Uncaught Error: Module build failed: Error: ENOENT: no such file or directory, open \'/Users/Egen/Code/angular/src/styles.css\'(…) 回答1: For Angular 6 check the Official documentation Note: For @angular/cli versions older than 6.0.0-beta.6 use ng set in place of

Could not find module “@angular-devkit/build-angular”

[亡魂溺海] 提交于 2019-11-26 02:39:43
问题 After updating to Angular 6.0.1, I get the following error on ng serve : Could not find module \"@angular-devkit/build-angular\" from \"/home/Projects/myProjectName\". Error: Could not find module \"@angular-devkit/build-angular\" from \"/home/Projects/myProjectName\". at Object.resolve (/home/Projects/myProjectName/node_modules/@angular-devkit/core/node/resolve.js:141:11) at Observable.rxjs_1.Observable [as _subscribe] (/home/Projects/myProjectName/node_modules/@angular-devkit/architect/src