Dev Abel
Dev Abel

Reputation: 133

Get value from promise response

from angular contoller I calling http service

curServices = Cust_Serv.get(id);
console.log(curServices);

My service calls like this

get:function(data){
        var id= {'id':data};
        var promise = $http.post('api/admin/cust_serv/getserv',id).
            success(function(response){
            }).
            error(function(){
                console.log('no services found');
            });

        return promise;

    },

I receive response object with $$state, catch, error, finally, success, then, proto. I need only the values that is inside $$state->value->data.

How to access that data?

Upvotes: 2

Views: 4675

Answers (1)

Dev Abel
Dev Abel

Reputation: 133

I followed as Bergi said and it worked.

Cust_Serv.get(id).then(function(response){
    curServices = response.data;
});

Upvotes: 2

Related Questions