Reputation: 1
I have a form with ng-submit with 2 functions func1 & func2. I want to run the func1 first and then func2 later.
My code looks like the following
$scope.funct1= function(){ };
$scope.funct2= function(){ };
Upvotes: 1
Views: 966
Reputation: 2240
If your functions is not promise
function.
Just need call two functions from View:
<form ng-submit="func1(); func2()">
// something
</form>
If your func1()
is promise function, call function 2 (inside function 1) when finished function 1:
$scope.func1 = function () {
// After finished this function, call function 2
$scope.func2();
};
Upvotes: 2
Reputation: 41447
call func2 inside func1
$scope.funct1= function(){
alert("func 1");
$scope.funct2();
}
$scope.funct2= function(){
alert("func 2")
}
Upvotes: 2