Dmitry Arushanov2016-03-24 17:22:22
Dmitry Arushanov, 2016-03-24 17:22:22

AngularJS Return value from resolve?

Good day to all. There is an Angular application from which I send requests to the rest server using Restangular. All objects received from the server via GET using Restangular have data about the remote rest inside the object. So I can easily call the PUT DELETE method on the received object.

var users = Restangular.all('users');
var user = users[0]; //user with id 1
user.put(); //put to /users/1

All methods for working with Restangular are described in separate services
. I call them in the controller and everything works.
But if I use resolve, then the object that then gets into the controller is devoid of these properties. That is, calling the methods .put() .remove() - causes an error.
This happens exactly when passing from resolve.
Has anyone encountered such a problem? And I didn’t find something how you can create a Restangular object from an existing one ...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question