How can I do more than one action with an ng-click in AngularJS -
in code there is:
<button class="btn float-right" data-ng-click="test()"> reset </button>
is possible me fire more 1 function when click of button. if how should code that?
update. call test()
function in current scope , othertest()
function in parent scope / controller.
i call test() function in current scope , othertest() function in parent scope / controller.
just define orthertest
in parent scope. example:
function parentcontroller($scope){ $scope.othertest = function(){ } }
there 2 ways achieve want: try:
function currentcontroller($scope){ $scope.test = function(){ } } data-ng-click="test();othertest()"
or:
function currentcontroller($scope){ $scope.test = function(){ $scope.othertest(); //your test code function } } data-ng-click="test()"
as scope inherited, current scope inherit othertest
parent scope
Comments
Post a Comment