In an Angular application don't try to use a ViewChild from a component's constructor or ngOnInit. Use ngAfterViewInit or ngOnChanges or one of the methods in the component. There is also a lot of pain to be had in nesting these controls inside of an *ngIf and a better thing to do is to use a CSS style to conditionally hide that which wraps a ViewChild.
No comments:
Post a Comment