| 1. |
How The Actions Performed On Model Is Translated To Restful Operations? Give An Example.? |
|
Answer» Models are used to represent data from your server and actions you perform on them will be translated to RESTful operations. The ID attribute of a model identifies how to find it on the database usually mapping to the surrogate key. Suppose you have a table Users with columns id, name, email and you want to save the model BACK on server when user clicks save button. If the id attribute of the model is NULL, Backbone.js will send a POST request to the urlRoot of the server. For this, see the example below: var UserModel = Backbone.Model.extend({ Models are used to represent data from your server and actions you perform on them will be translated to RESTful operations. The id attribute of a model identifies how to find it on the database usually mapping to the surrogate key. Suppose you have a table Users with columns id, name, email and you want to save the model back on server when user clicks save button. If the id attribute of the model is null, Backbone.js will send a POST request to the urlRoot of the server. For this, see the example below: var UserModel = Backbone.Model.extend({ |
|