Reputation: 387
I am very New to AngularJS and I have an web Application that calls an ng-click when a button is clicked. I would like to add code to call this function on page load.
This is the where the function is called in the code. Is there anyway to do this?
Upvotes: 0
Views: 78
Reputation: 519
When element is loaded you can fire ng-init
<div ng-init="zoom.fit()">
some code
</div>
Upvotes: 1
Reputation: 1134
Use this in your controller
$scope.$on('$viewContentLoaded', function() {
$scope.zoo.fit();
});
Upvotes: 0