I had a similar issue. Looking at the lifecycle hooks documentation, I changed ngAfterViewInit
to ngAfterContentInit
and it worked.
More Related Contents:
- Angular HTML binding
- Triggering change detection manually in Angular
- @ViewChild in *ngIf
- What’s the difference between markForCheck() and detectChanges()
- How to force a component’s re-rendering in Angular 2?
- How to detect when an @Input() value changes in Angular?
- Trigger update of component view from service – No Provider for ChangeDetectorRef
- Angular2 ngFor OnPush Change Detection with Array Mutations
- Angular2: *ngFor does not update when array is updated
- Angular 2 – how round calculated number?
- Angular/RxJS When should I unsubscribe from `Subscription`
- Is it necessary to unsubscribe from observables created by Http methods?
- Focus on newly added input element
- How to inject window into a service?
- How to bundle an Angular app for production
- Difference between HttpModule and HttpClientModule
- How to get current route
- Angular 2 – Execute code when closing window
- vs
- Angular 2 Basic Authentication not working
- Property ‘json’ does not exist on type ‘Object’
- Error: Unexpected value ‘undefined’ imported by the module
- Update parent component property from child component in Angular 2
- How to use variable to define templateUrl in Angular2
- ‘node-sass’ usage is deprecated and will be removed in a future major version
- Observable.of is not a function
- origin ‘http://localhost:4200’ has been blocked by CORS policy in Angular7
- How to execute only one test spec with angular-cli
- How to change angular material datepicker format
- How to make a post request with angular 5