Answer the question
In order to leave comments, you need to log in
How to run a function directly in Angular?
<button class="btn btn-md btn-md-primary" ng-click="importContact()" my-i18n="contacts_modal_new_contact">New contact</button>
Answer the question
In order to leave comments, you need to log in
add a scoped function to the module's run or, better yet, write a controller.
I don’t know what task you are trying to solve, but if you need a function to be called when a button appears in the DOM, then you can use ng-init
<button class="btn btn-md btn-md-primary" ng-init="importContact()" ng-click="importContact()" my-i18n="contacts_modal_new_contact">New contact</button>
I understand that we are talking about the good old clickers on the sites. Right?
And if everything is simple with JS, then pulling a function from $scope is problematic.
If from the console, then there is an extension to Batarang chrome.
I pull like this
angular.element($0).scope().addTodo(); // Дергаю функцию
angular.element($0).scope().$apply(); // Для обновления данных на экране
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question