You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that if you use templateUrl in a child component, ngAfterViewInit() on the parent component will fire before the child's template is loaded, and thus the componentInstance field will be null for that child.
In my app, simply changing out templateUrl on the component whose componentInstance is null with a template string causes componentInstance to be available. Hopefully I've identified it right since I'm not sure the best way to make a demonstration given the dependencies.
The text was updated successfully, but these errors were encountered:
Yeah Angular 1 doesn't wait for child template urls to fully load because it might slow the app way down. I'm wondering if there is an easy way we could at least have the hook wait. Honestly I'm not sure how high of a priority this is to me... I highly recommend keeping your templates inline. But I'll do some thinking on this.
Just double checked, the ngAfterViewInit() for the child component itself correctly fires after the template is loaded. Just a parent's ngAfterViewInit() is too early for its children to load their templates.
It appears that if you use templateUrl in a child component, ngAfterViewInit() on the parent component will fire before the child's template is loaded, and thus the componentInstance field will be null for that child.
In my app, simply changing out templateUrl on the component whose componentInstance is null with a template string causes componentInstance to be available. Hopefully I've identified it right since I'm not sure the best way to make a demonstration given the dependencies.
The text was updated successfully, but these errors were encountered: