javascript - AngularJS 渲染所有 View 后如何调用函数

标签 javascript angularjs

如何在成功加载所有 AngularJS View 后调用一个简单的函数。

function hello() {
  alert('All AngularJS works are done');
}

<!-- Below code is example about how I need a function for AngularJS loaded event -->
app.onAngularLoaded(function () { hello(); });
</script>

最佳答案

尝试将超时设置为 0。这将在当前的摘要周期集之后发生。

$timeout(function(){...}, 0);

关于javascript - AngularJS 渲染所有 View 后如何调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29901732/

相关文章:

javascript - MySql 时间戳和 JavaScript 时间

javascript - 为什么 React.Js 模板和 Angular 模型之间没有绑定(bind)?

javascript - 需要帮助将 node.js 连接到 angular.js

javascript - 插入数组内的第一个对象

javascript - 如何处理所有 AJAX 调用的特定 HTTP 错误?

javascript - 连接 NextJS、next-i18next、with-redux、with-redux-saga : "Error: If you have a getInitialProps method in your custom _app.js file..."

javascript - Angular 在 ui-router View 中不显示非英文字母

javascript - 为什么 JavaScript 函数对象允许与字符串到值映射格式不同?

css - Ionic - 更改元素内容的位置

javascript - grunt uglify 后 Angularjs 注入(inject)器错误