Upon reviewing the jQuery documentation, I discovered the following:
$.get( "example.php", function() {
alert( "success" );
})
.done(function() {
alert( "second success" ); <---
})
.fail(function() {
alert( "error" );
})
.always(function() {
alert( "finished" );
});
Now, in my Angular controller, I have a requirement to execute a method after making multiple ajax calls. Here's an example of what I want to achieve:
$q.all([
$http.get(ROOT + "Lookup/GetStates"),
$http.get(ROOT + "Lookup/GetCountries"),
$http.get(ROOT + "Address/GetAddresses"),
]).then(function (results) {
$scope.states = jQuery.parseJSON(results[0].data.data);
$scope.country = jQuery.parseJSON(results[1].data.data);
$scope.addresses = jQuery.parseJSON(results[3].data);
});
Following the then
execution, specifically (only after the then), I need to invoke a method called $scope.setupControls()
.
Is there a way to accomplish this?