angularjs promise+http

Em Andamento Postado há 4 anos Pago na entrega
Em Andamento Pago na entrega

i have a code running in angularjs 1.4.7 that call multiple HTTP, each time a HTTP is done i display value and when all HTTP are done i do a work. in angularjs 1.7.8 success is deprecated, and i don't know how migrate the code to 1.7.8 to have an action when all is done and get value each time http is done, i don't want to wait end of http array to display results

it is a basic angular exercice with promise http, array of promise, ... but i don't know

********** ANGULAR 1.4.7 ************************

var app = [login to view URL]('app', ['ngRoute', 'ngResource']);

[login to view URL](function ( $routeProvider, $httpProvider) {

$[login to view URL](function($q) {

return {

'response': function(response) {

return response || $[login to view URL](response);

},

'responseError': function(response) {

return {data:"error server",statut:[login to view URL]}; //$[login to view URL](response);

}

};

});

});

[login to view URL]('MainCtrl', function ($scope, $http,$q) {

$scope.promises=[];

$scope.list=[{url:"[login to view URL]",value:null},{url:"[login to view URL]",value:null}];

for(i in $[login to view URL]) $[login to view URL](

$http({method: 'GET', url: $[login to view URL][i]["url"], cache: 'false',

transformResponse: function (data, headersGetter) {

//headersGetter["indice"] contains indice in case you need it

try {

var jsonObject = [login to view URL](data);

// verify that json is valid

return jsonObject;

}

catch (e) {

return {erreur:data};

}

return {};

}

}).success(function(data, status, headers, config){

if(typeof data === 'object') $[login to view URL][[login to view URL]]["value"]=data;

}).error(function(data, status) { })

);

$[login to view URL]($[login to view URL] ).then(function(data){

for(i in data)

{

[login to view URL](data);

[login to view URL](list[i]);

}

})

});

AngularJS JavaScript

ID do Projeto: #21517765

Sobre o projeto

1 proposta Projeto remoto Ativo em há 4 anos