How we can add 2 function with one ng-click
. I try like this :
ng-click="Save(); Send();"
but I want to save first then send. Both function having API calls.
How we can add 2 function with one ng-click
. I try like this :
ng-click="Save(); Send();"
but I want to save first then send. Both function having API calls.
call a function like this ng-click="callto2functions()"
$scope.callto2functions =function(){$scope.save();$scope.send();}
the problem is that both your functions return a promise when they are doing api calls (at least they should do that)
but when you chain them they will be fire immediately. since they are promises you can chain them with .then(). this is not possible in the template, so you can build a separate function that handles that case
function saveAndSend() {
save()
.then(function(savedData) {
return send();
});