ruby on rails - angularjs add a model layer -
I am using angle with the rail backend and I'm using the $ resource to interrupt the backend API I am Therefore, I have a user service that is a resource resource
App.factory ('user', ['$ resource', function ($ resource) {return $ resource ('/ user / I can now use User to interact with Rail API: ID ', {id:' id '});}] But the problem is all the tasks with an HTTP request for the rail operations at the end of the user. The scenario is where I just got this model I want to make an example, but not to interact with rail, in the conference of rail, I need a
User.new which is a user Returns the object, but no User.create will save this object on the server.
This is a matter of thought that I can do the following:
var user = User.new ({attr1: value1, attr2: value2 .....}); New Price User Promise with Prices Provided = User. Create (user) // How it can be achieved
As apneadiving pointed out, the resource example is the trick!
var user = new user ({attr1: value}), user Save $
Comments
Post a Comment