News for hackers. Stuff that matters.
Re:How to Wire Up Ruby on Rails and AngularJS as a Single-Pa... by kclay on Tuesday July 22, 2014 @11:29AM (#8069483)
Fyi promise unraveling has been deprecated after Angular 1.2. So it should be

  Group.query().then(function(groups){
   $scope.groups = groups;
})
Re:How to Wire Up Ruby on Rails and AngularJS as a Single-Pa... by donmack on Tuesday July 22, 2014 @04:02PM (#8071261)
Do you have a link to any discussion on that?

It looks like the docs still suggest the method used in the blog post: https://docs.angularjs.org/api/ngResource/service/$resource

"It is important to realize that invoking a $resource object method immediately returns an empty reference [...] Once the data is returned from the server the existing reference is populated with the actual data. This is a useful trick since usually the resource is assigned to a model which is then rendered by the view. [...] This means that in most cases one never has to write a callback function for the action methods."

Re:How to Wire Up Ruby on Rails and AngularJS as a Single-Pa... by donmack on Friday July 25, 2014 @11:01AM (#8085534)
Thanks. Okay, that makes sense.

The $resource usage described still works in version 1.2.19, with no promise unwrapping options set. I could be wrong, but I think it is because the $resource returns a reference to an empty object that has values copied into it when the call completes. The actual promise is a property named $promise on the returned object.

Example: http://jsfiddle.net/92zmG/7/