Calling a function when the template is loaded in angular js


I’ve been going through a lot of answers here and i didn’t find one relevant to my issue. I’m sorry if its already answered. I’m a newbie to angular js presently started working on angular routing.
I have an application which loads templates using $routeProvider and i need to call a function soon after the template gets loaded with all the images. Is that possible? Any simple Method to do this?


You can use ng-init directive which calls a function required in your case.

Add ng-init="yourfunction()" somewhere at the starting point of the page.

<div ng-init="LoadThings()">

Answered By – Sajeetharan

Answer Checked By – Clifford M. (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.