【发布时间】:2013-09-09 21:41:03
【问题描述】:
我的 Angular 控制器中有一个函数,我希望在准备好文档时运行该函数,但我注意到 Angular 在创建 dom 时运行它。
function myController($scope)
{
$scope.init = function()
{
// I'd like to run this on document ready
}
$scope.init(); // doesn't work, loads my init before the page has completely loaded
}
有人知道我该怎么做吗?
【问题讨论】:
标签: javascript angularjs onload