Is there an angular event which will be triggered when all the Angular2 components have finished rendering?
For jQuery
, we can use
$(function(){ ... })
However, with Angular2, when the domready
event is triggered, the html contains angular component tags only. And after each component finished rendering, the domready
event will be triggered again & again.
What we need is a final event when all the angular components have finished rendering.
Have you tried ngAfterViewInit on the root
AppComponent
? I'm sure all the components have been rendered by then. This is a hook that angular calls after it creates all the component's child views.you may check
ngAfterViewInit
applied on the root component.Read more about it here.
Hope this helps!!