top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Can we call two functions in ng-click directive?

+4 votes
312 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
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...