admin管理员组文章数量:1414628
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!!
本文标签: javascriptHow to determine all the angular 2 components have been renderedStack Overflow
版权声明:本文标题:javascript - How to determine all the angular 2 components have been rendered? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745176393a2646260.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论