backbone.js - How to pass options to ItemView in Marionette? -


i use marionette , want pass variables itemview. tried follow instructions here: http://marionettejs.com/docs/v2.4.1/marionette.functions.html#marionettegetoption it's not working. code is:

module.exports = function(p_hash) {     var treeview = marionette.itemview.extend({         template: '#tree',         initialize: function(attributes, options) {             if (options.type == "organizations") {                 ...             }         }     });     return new treeview();  };  ...  var organizations_tree = new treeview({}, {type: "organizations", two_levels: false}); 

my options undefined in initialize method.

i miss simple.

do have idea?

thanks, alex a.

the initialize method of view should take in 1 parameter.

ex:

initialize: function(options) {  } 

you're thinking of backbone.model has 2 parameters:

initialize: function(attributes, options) {  } 

Comments