且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何加载脚本时angular.js部分加载

更新时间:2023-12-05 15:58:28

这似乎与此类似问题 AngularJS pretty:如何运行AngularJS后附加code已经呈现模板?

Accordng这个,你***的选择可能是使用$ evalAsync()

Accordng to this, your best bet might be to use $evalAsync()

http://docs.angularjs.org/api/ng 。$ rootScope.Scope #$ evalAsync

http://docs.angularjs.org/api/ng.$rootScope.Scope#$evalAsync

虽然那种取决于你正在试图运行code是(张贴请?)。我的建议是尝试angularize无论你想在模板加载后这样做,你可以在你的控制器包含它。如果不行,再寻找其他解决方案。

Although that kind of depends on what the code you're trying to run is (post it pls?). My advice is try to "angularize" whatever you're trying to do after the template has loaded so that you can include it in your controller. If that doesn't work, then look for other solutions.