top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can we call two functions in ng-click directive?

+4 votes
703 views

If yes, Which one will be called first?

posted May 28, 2015 by Muskan

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

One can use and call two functions in a single ng-click directive,

one can use like this with ng-click directive in html .

<div ng-controller="Ctrl1">
    <h2 ng-click="toto(); titi();">Click me</h2>
</div>

And can call the functions like this, you can call any functions which ever necessary for you at first.

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


function Ctrl1($scope) {

    $scope.toto = function(){
        alert('toto');
    };

    $scope.titi = function(){
        alert('titi');
    };

}

answer Jan 10, 2017 by Ramya
...