AngularJS:回调后呈现(工作,DOM渲染后) [英] AngularJS: callback after render (work with DOM after render)
本文介绍了AngularJS:回调后呈现(工作,DOM渲染后)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何运行的方法 $ scope.myWork()
渲染模板之后?我想设置 $ scope.value
之后,我需要改变使用jQuery的东西(如在模板内容DOM)。 $范围。$腕表('值',函数(){....})
正在之前渲染(模板的DOM是尚未公布)。谢谢你。
How can run a method $scope.myWork()
after render template? I want to set the $scope.value
and after that I need to change something with JQuery (eg. in DOM of template content). $scope.$watch('value', function (){....})
is working "before" render (DOM of template is not available yet). Thanks.
推荐答案
创建一个运行您的$ C $一个指令 c。在链接功能。
模板建成后连接函数被调用。
Create a directive that runs your code in the link function. The link function is called after the template is built.
请参阅 NG-点击以得到一个想法。
See ng-click to get an idea.
这篇关于AngularJS:回调后呈现(工作,DOM渲染后)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文