1

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

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

viewContentLoaded is instead of onload i think .what about onready ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.