I'm learning backbone / marionette js and i'm using a boilerplate to do so : https://github.com/BoilerplateMVC/Marionette-Require-Boilerplate-Lite
I have created 2 view (welcome / files) and 2 regions : mains and header.
In my headerRegion there is my navbar and I would like to handle the "active" class of my menu (template: header.html) on change or reload... but I can't figure out what is the best way to do it
I have defined a Region in my App.js :
App.addRegions({
headerRegion:"header",
mainRegion:"#main"
});
In my controller i create a new HeaderView on init:
initialize:function (options) {
App.headerRegion.show(new HeaderView(options));
}
And this is my HeaderView :
define([ 'marionette', 'handlebars', "App", 'text!templates/header.html'],
function (Marionette, Handlebars, App, template) {
//ItemView provides some default rendering logic
return Marionette.ItemView.extend({
template:Handlebars.compile(template),
initialize: function (options) {
_.bindAll();
},
onRender : function(options){
$('ul.nav li', this.$el).removeClass('active');
}
});
});
});
Thanks for your help :) !