The Backbone.js project has published a new minor release of its framework.

View Options
A minor change done is the options registration in Views.
In version 1.0.0 one could create a view with some parameters such as the following example:

new MyView({collection: entries,  viewContainer: $('#entries-container'), param1 : param2});

In the view, you could directly access the parameters directly in the render method:

render: function() {
  var container = this.options.viewContainer;
  var param1 = this.options.param1;

In version 1.1.0, the options array is no longer registered in the view by default. To still use the render method as it is shown above, you need to register the options array by yourself during initialization:

initialize: function(options) {
  this.options = options;

Afterwards, you can use the code of your render method as you have been used to.

Backbone.js Version 1.0.0 to Version 1.1.0

Post navigation

Leave a Reply