I was trying the solutions that suggest in this questions but it don't work
How to pass parameters to a view
How can I pass a parameter into a Backbone.js view?
Backbone.js - passing arguments through constructors
I am trying to pass extra parameter to use in my template, I read that all extra params that I pass I can have access to them in this.options.varName
but it dont work for me.
heres the controller code:
servicios : function(){
//Crea la colecion de tipos de servicios municipales
//Crea el modelo para dar de alta un nuevo reporte de servicio municipal
var reporteServicioSingle = new ReporteServicioSingle();
//Crea la vista para la pantalla de servicios municipales
var servicios_view = new Servicios({
model : reporteServicioSingle,
collection : this.reportes,
tipos : this.tipos
});
// Carga la vista renderisada y inicializa foundation
$("#app-content").html(servicios_view.render().el);
$(document).foundation();
},
And this is my view code:
render: function(){
console.log(this.options.tipos);
this.$el.html(Handlebars.templates.servicios(this.collection));
$(document).foundation();
return this;
},
but the chrome developers console, send me an error that options is not definided.
Uncaught TypeError: Cannot read property 'tipos' of undefined
Thank you and sorry for my bad english.