Yes, it's possible.
You can create a click(arg1,arg2)
method in $scope
and specify it as ng-click
.Try the snippet below.
angular.module('app', [])
.run(function($rootScope){
$rootScope.click=function(arg1,arg2){
alert(arg1+arg2);
};
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
<div ng-app="app">
<button ng-click="click(1,2)">Click</button>
</div>
© 2024 OneMinuteCode. All rights reserved.