Reputation: 655
I study in jquery that when only html load it fire document.ready function and when all images or everything load it fire onload function.Same I need to find in angular could you please tell what first function fire and when html is load and what function fire when everything is load in angularjs ?
Thanks
Upvotes: 1
Views: 1019
Reputation: 20445
lets say that you have a div to which you want to attach on load function
<div ng-controller="MainCtrl">
<div ng-view></div>
</div>
From MainCtrl you can listen the event
$scope.$on('$viewContentLoaded', function(){
});
You can listen in your controllers defined in routes like myController and myRouteController for $viewContentLoaded event, $viewContentLoaded is emitted every time the ngView content is reloaded and should provide similar functionality as the document.ready when routing in angularjs
Upvotes: 1