Note that there are some explanatory texts on larger screens.

plurals
  1. POSend extra params to a view on backbone.js
    primarykey
    data
    text
    <p>I was trying the solutions that suggest in this questions but it don't work</p> <p><a href="https://stackoverflow.com/questions/7803138/backbone-js-how-to-pass-parameters-to-a-view">How to pass parameters to a view</a></p> <p><a href="https://stackoverflow.com/questions/17561022/how-can-i-pass-a-parameter-into-a-backbone-js-view">How can I pass a parameter into a Backbone.js view?</a></p> <p><a href="https://stackoverflow.com/questions/8463537/backbone-js-passing-arguments-through-constructors">Backbone.js - passing arguments through constructors</a></p> <p>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 <code>this.options.varName</code> but it dont work for me.</p> <p>heres the controller code:</p> <pre><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(); }, </code></pre> <p>And this is my view code:</p> <pre><code>render: function(){ console.log(this.options.tipos); this.$el.html(Handlebars.templates.servicios(this.collection)); $(document).foundation(); return this; }, </code></pre> <p>but the chrome developers console, send me an error that options is not definided.</p> <pre><code>Uncaught TypeError: Cannot read property 'tipos' of undefined </code></pre> <p>Thank you and sorry for my bad english.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload