Is there an angular event which will be triggered when all the Angular2 ponents have finished rendering?
For jQuery
, we can use
$(function(){ ... })
However, with Angular2, when the domready
event is triggered, the html contains angular ponent tags only. And after each ponent finished rendering, the domready
event will be triggered again & again.
What we need is a final event when all the angular ponents have finished rendering.
Is there an angular event which will be triggered when all the Angular2 ponents have finished rendering?
For jQuery
, we can use
$(function(){ ... })
However, with Angular2, when the domready
event is triggered, the html contains angular ponent tags only. And after each ponent finished rendering, the domready
event will be triggered again & again.
What we need is a final event when all the angular ponents have finished rendering.
Share Improve this question edited Nov 2, 2016 at 14:59 Poul Kruijt 72.1k12 gold badges152 silver badges151 bronze badges asked Nov 2, 2016 at 14:52 mind1nmind1n 1,2063 gold badges17 silver badges34 bronze badges2 Answers
Reset to default 4Have you tried ngAfterViewInit on the root AppComponent
? I'm sure all the ponents have been rendered by then. This is a hook that angular calls after it creates all the ponent's child views.
you may check ngAfterViewInit
applied on the root ponent.
ngAfterViewInit Respond after Angular initializes the ponent's views and child views. Called once after the first ngAfterContentChecked.
Read more about it here.
Hope this helps!!