Call multiple functions in ng-click

We know how to pass a function as parameter to ng-click. We can pass multiple functions as parameters to ng-click directive. Each function must be separated by a semi-colon(;).

For instance the button's ng-click directive would look like

<input type="button" ng-click="first();second()" value="Click me"/>















My javascript code would look something like this.


var app=angular.module('app',[]);

app.controller('myController',function($scope){
  
  $scope.first=function(){
    alert("from first function");
  };
  
  $scope.second=function(){
    alert("from second function");
  };
  
});
  

A working demo can be found here

Comments

Popular Posts