Angular2-多次调用ngAfterViewChecked ..如何在DOM完全加载后立即调用一个方法? [英] Angular2 -- ngAfterViewChecked is called many times..How to call a method just once after DOM is completely loaded?
本文介绍了Angular2-多次调用ngAfterViewChecked ..如何在DOM完全加载后立即调用一个方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用Typescript
将jquery
插件应用于Angular2
中的单选按钮.
I need to apply jquery
plugin to radio buttons in Angular2
using Typescript
.
如果我在ngAfterViewChecked
中进行分配,则会调用多次,并且控件会刷新多次.
If I assign in ngAfterViewChecked
, it is called many times and the control is refreshed multiple times.
在DOM准备就绪后调用javascript方法的替代解决方案是什么?
What is the alternate solution for calling the javascript method after DOM is ready?
推荐答案
尝试ngAfterViewInit
并查看
查看全文