getting results of custom action in rails with angularjs -
I am using 3.2 rail with angular, and I understand how to use angular resources.
Resource (Do not Get It, Save, Query, Remove, and Delete) to return results from non-default action
Then I have in my mail controller and then in my JS file I have If I try and def home @recent_posts = Post. Format.html format.json end end
app.factory "post", ["$ resource", ($ Resource) - & gt; $ HOMECtrl = ["$ scope", "$" ("/ post /: id /: action", {id: "@id"}, {home: {method: "GET", isArray: true}}) ", ($ Scope, post) - & gt; $ Scope.recent_posts = Post.home ()]
ng-repeat =" recent_posts Post ", you have forgotten to specify the
verb {/ code> parameter:
app.factory "post", ["$ resource", ($ resource) - & gt; $ Resource "/ post /: id /: action", id: "@id", home: method: "received" parameter: verb: "home" is alright:
Comments
Post a Comment