O'Reilly logo

Learning Yeoman by Jonathan Spratley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Backbone.Model

The Backbone.Model class is used to extend application-specific domain methods and logic, which provide functionality to manage changes to data, and the ability to send CRUD (GET/PUT/POST/DELETE) operations on the server and dispatch many useful events.

Note

For more information on Backbone.Model, visit http://goo.gl/f9Wj2l.

To bind to the model events, use the model.on('name', callback) function, which will trigger the callback when that event is invoked.

Scaffolding models

To create a new model, use the backbone:model subgenerator, open the terminal, and execute the following command to create a new post model:

$ yo backbone:model post

This command will create a new file named post.coffee located in the app/scripts/models directory; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required