我的angular控制器中有一个函数,我希望这个函数可以在document ready上运行,但我注意到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
}
有人知道我该怎么做吗?