0

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.

enter image description here

This is the where the function is called in the code. Is there anyway to do this?

2 Answers 2

1

When element is loaded you can fire ng-init

<div ng-init="zoom.fit()">
  some code
</div>

ng-init documentation

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

Comments

0

Use this in your controller

$scope.$on('$viewContentLoaded', function() {
  $scope.zoo.fit();
});

1 Comment

What if I dont know where the controller is and the only way I can call this is from javascript?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.