Thursday, May 21, 2015

Angular-JS transformReponse Using $http service

Dear All,

Please fallow the link below to download source code.

SOURCE CODE

Thanks & regards,

Vikram Y.

2 comments:

  1. hi. sir subbareddy here ur student. can u pls upload single page application ui-router example.

    ReplyDelete
  2. angular.module('myApp').service('MyService', function($q, $resource) {
    var getResult = function() {
    var fullResult = $q.defer();
    $resource('url').get().$promise.then(function(data) {
    var partialPromises = [];
    for (var i = 0; i < data.elements.length; i++) {
    var ires = $q.defer();
    partialPromisses.push(ires);
    $resource('url2').get().$promise.then(function(data2) {
    //do whatever you want with data
    ires.resolve(data2);
    });
    $q.all(partialPromisses).then(function() {
    fullResult.resolve(data);
    });
    return fullResult.promise; // or just fullResult
    }
    });
    };
    return {
    getResult: getResult
    };
    });

    AngularJS Training in Chennai

    ReplyDelete