angular8

Lazy-loaded modules warnings after updating Angular from 8 to 9

大城市里の小女人 提交于 2020-06-01 07:01:09
问题 After Angular update all lazy-loaded modules return warning: Error: [path/to/module/module-name.ts] is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. My function which returns modules array: export function manifests(prefix = '') { return [ { loadChildren: () => import(prefix + '/path/to/a.module').then(m => m.AModule), path: 'a', }, { loadChildren: () => import(prefix + '/path/to/b.module').then(m => m.BModule), path:

How to destroy component created dynamically angular 8

醉酒当歌 提交于 2020-05-30 06:45:25
问题 I'm new to Angular. I have a button that every time I click it, it creates a component dynamically. I need each component to have a button or something that can destroy that component specifically. I have a function in the dynamic component that when I click on it, that component must be closed, but I don't know how to pass it to the function of the typescript file.Please help me. app.component.ts import { Component, OnInit, ComponentFactoryResolver, ViewChild, Input,ComponentRef

Angular Difference ViewChild vs ControlValueAccessor

那年仲夏 提交于 2020-05-28 07:17:11
问题 What's the difference between ViewChild and ControlValueAccessor in Angular? Seems both of them can access child components, directives, DOM. So curious about the differences in usage, can one do something the other cannot do? 回答1: ControlValueAccesor is for making a custom form control . By steps, a FormControl can store anything, even an object. Imagine two different FormGroups form1=new FormGroup({ name:new FormControl('name') direcction:new FormControl({address:'address',cp:'cp'}) })

Angular Difference ViewChild vs ControlValueAccessor

房东的猫 提交于 2020-05-28 07:16:32
问题 What's the difference between ViewChild and ControlValueAccessor in Angular? Seems both of them can access child components, directives, DOM. So curious about the differences in usage, can one do something the other cannot do? 回答1: ControlValueAccesor is for making a custom form control . By steps, a FormControl can store anything, even an object. Imagine two different FormGroups form1=new FormGroup({ name:new FormControl('name') direcction:new FormControl({address:'address',cp:'cp'}) })

Angular Difference ViewChild vs ControlValueAccessor

微笑、不失礼 提交于 2020-05-28 07:16:26
问题 What's the difference between ViewChild and ControlValueAccessor in Angular? Seems both of them can access child components, directives, DOM. So curious about the differences in usage, can one do something the other cannot do? 回答1: ControlValueAccesor is for making a custom form control . By steps, a FormControl can store anything, even an object. Imagine two different FormGroups form1=new FormGroup({ name:new FormControl('name') direcction:new FormControl({address:'address',cp:'cp'}) })

Angular Difference ViewChild vs ControlValueAccessor

我与影子孤独终老i 提交于 2020-05-28 07:15:10
问题 What's the difference between ViewChild and ControlValueAccessor in Angular? Seems both of them can access child components, directives, DOM. So curious about the differences in usage, can one do something the other cannot do? 回答1: ControlValueAccesor is for making a custom form control . By steps, a FormControl can store anything, even an object. Imagine two different FormGroups form1=new FormGroup({ name:new FormControl('name') direcction:new FormControl({address:'address',cp:'cp'}) })

Angular Difference ViewChild vs ControlValueAccessor

核能气质少年 提交于 2020-05-28 07:14:48
问题 What's the difference between ViewChild and ControlValueAccessor in Angular? Seems both of them can access child components, directives, DOM. So curious about the differences in usage, can one do something the other cannot do? 回答1: ControlValueAccesor is for making a custom form control . By steps, a FormControl can store anything, even an object. Imagine two different FormGroups form1=new FormGroup({ name:new FormControl('name') direcction:new FormControl({address:'address',cp:'cp'}) })

How to implement behavior subject using service in Angular 8

眉间皱痕 提交于 2020-05-27 05:40:10
问题 I'm new to Angular and I'm having an issue. I'm creating an app with several sibling components. When I update a value in one component other components don't update. I know that to resolve this issue I should use behaviour subject . But how do I implement it with my service, the components and all the templates? Here is my code - ---------------------- My service --------------------------- //import @Injectable() export class CoachService { apiURL = environment.apiURL; constructor(private

How to add to array if no response during 1 second?

爷,独闯天下 提交于 2020-05-26 10:03:25
问题 I have an intercept that listens requests/responses. I have tried to run spinner only if requests comes more then 1 seconds: @Injectable() export class LoadingInterceptor implements HttpInterceptor { private requests: HttpRequest<any>[] = []; constructor(private spinnerService: SpinnerService) {} intercept( req: HttpRequest<any>, next: HttpHandler ): Observable<HttpEvent<any>> { this.requests.push(req); this.spinnerService.isLoading.next(true); return new Observable((observer) => { next

How to add to array if no response during 1 second?

天涯浪子 提交于 2020-05-26 10:03:16
问题 I have an intercept that listens requests/responses. I have tried to run spinner only if requests comes more then 1 seconds: @Injectable() export class LoadingInterceptor implements HttpInterceptor { private requests: HttpRequest<any>[] = []; constructor(private spinnerService: SpinnerService) {} intercept( req: HttpRequest<any>, next: HttpHandler ): Observable<HttpEvent<any>> { this.requests.push(req); this.spinnerService.isLoading.next(true); return new Observable((observer) => { next