vendredi 21 août 2015

why a checkbox doesn't work using iron-router on meteor?

i try to add some checkboxes in order to retrieve true/false values

in my main project doesn't work, i think it was some error, i search and i cant find anything wrong

i make once again the official meteor tutorial (ToDo app without angular), the first 5 levels and it works as expected (im really happy that it works and it could be my problem)

i create a new project using just iron-router, and checkboxes doesn't work

in index.html: <template name="checkboxList"> {{#each tasks}} <input type="checkbox" checked="{{checked}}" class="toggle-checked" /> {{text}} <br> {{/each}} </template>

in index.js:

Template.checkboxList.helpers({
    tasks: [
      { text: "This is task 1" },
      { text: "This is task 2" },
      { text: "This is task 3" }
    ]
});

Template.checkboxList.events({
     "click .toggle-checked": function () {
        console.log(this.text +" click " + this.checked);
     }
 });

in router.js:

Router.route("/",function () {
 this.render('checkboxList');
});

so this is all the code i add in order to reproduce the 'bug'

im new using meteor so maybe i don't understand how meteor works

thanks in advance

Aucun commentaire:

Enregistrer un commentaire