Invoking a Function on a Controller
Procedure
-
Define a scope function under the
defineScopeblock in the controller.defineScope : function() { ... this.$scope.myFunction= function() { //DO SOMETHING } .... }, -
Invoke the function on the scope directly on user action or
based on some business logic.
<button data-ng-click="myFunction()"> value="CLICK ME!" // INVOKES THE FUNCTION myFunction defined on $scope on user click </button>