javascript - How to determine all the angular 2 components have been rendered? - Stack Overflow

Is there an angular event which will be triggered when all the Angular2 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.

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 badges
Add a ment  | 

2 Answers 2

Reset to default 4

Have 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!!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745176394a4615213.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信