A
A
Alexander2014-06-22 11:36:32
JavaScript
Alexander, 2014-06-22 11:36:32

How to get response from server in angularjs using $resource after saving model ?

todo = new Todo();
todo.text = 'text'
todo.done = false
todo.$save()

In response, the server sends a json response.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2014-06-22
@miraage

From documentation.

var User = $resource('/user/:userId', {userId:'@id'});
     User.get({userId:123}, function(u, getResponseHeaders){
       u.abc = true;
       u.$save(function(u, putResponseHeaders) {
         //u => saved user object
         //putResponseHeaders => $http header getter
       });
     });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question