Three parts of the backbone:
Model: Models
Each property of model can have a corresponding listener function, that is, when the value is changed, the listener function is invoked.
Model is a core module in any JavaScript application, including data that needs to be accessed frequently, as well as a large number of sessions, checksums, and computed property-level access controls that need to be expanded around the data.
Create a backbone.js model
| The code is as follows |
Copy Code |
Person = Backbone.Model.extend ({ Initialize:function () { Alert (' Welcome to the World '); } }) var person = new person (); |
When we create a new object for person, the Initialize () function is called immediately (initialize works in model, Collection, view). Although the Initialize () function is not a function that has to be defined, it will gradually discover its wonders in the actual development process.
Collection: Collection
View: Views