On Thu, Oct 30, 2014 at 9:44 AM, 'Michael Bielski' via AngularJS <
angular@googlegroups.com> wrote:

> Yes, we are aware of that. We did it this way so that we could do any
> other processing that we needed to the data before it is sent back. I
> should have explained that, sorry.
>
>
It certainly works to make the new promise as you did in your example. I
believe the more idiomatic way to post processed the data using promises is
to chain it more like this though.

function doSomething() {
  return myResource.query().$promise.then(data) {
    return someProcessingOf(data);  // gets wrapped for you.
  };
}

I don't mean to sound like I'm saying how the code has to be written. It is
an API, it can be used in 1000 different ways. I've just made it my
personal mission to notice when people are needlessly writing extra lines
of code around promises, and to point out how changing works so that they
can use it if they like :-)


-- 
Kyle Cordes
http://kylecordes.com

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to