Invoking a Function on a Controller

Procedure

  1. Define a scope function under the defineScope block in the controller.
    defineScope : function() {
         ...
         this.$scope.myFunction= function() {
     
            //DO SOMETHING 
         }  
       ....    
    },
    
  2. 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>