Reputation: 195
ng-click cannot call googlesearch function and keywordsearch fuction.
How to call two functions ng-click??? i would like to know how to create the single click, but run two functions by order.
for example:
That is on single click first function(googlesearch) executes
and then second function(keywordsearch) executes respectively.
html
<div class="test" ng-controller="Ctrl">
<input tpye="text" ng-model="keyword"/>
<button ng click="googlesearch(keyword);keywordsearch(keyword)">search</button>
</div>
<div>
angularjs
var app = angular.module('app', []);
function Ctrl($scope) {
$scope.googlesearch=function(keyword){
alert("do the googlesearch 1 "+keyword);
};
$scope.keywordsearch=function(keyword){
alert("do the keywordsearch 2 "+keyword);
};
}
Upvotes: 0
Views: 458
Reputation: 222582
Call the second function inside your first one,
$scope.googlesearch=function(keyword){
alert("do the googlesearch 1 "+keyword);
$scope.keywordsearch(keyword);
};
Upvotes: 2