Hi! I'm completly new in CanJS (noob on JS generally), i'm playing with
the recipes and getting started to learn, but in one recipe i have this issue:
When i render the template in the browser, console throw's me an "malformed" message in the main.hgn template, the code is basic:
Thanks for all answers!
PD: sorry about my bad english u.u
When i render the template in the browser, console throw's me an "malformed" message in the main.hgn template, the code is basic:
- <ul>
{{#each people}}
<li {{data 'person'}}>
{{lastname}}, {{firstname}}
</li>
{{/each}}
</ul>
- var peopleList = can.Control({
init: function (element, options) {
this.options = new can.List(options.people);
this.element.html(can.view('views/main.hgn', { people: this.people }));
},
'li click': function (li, ev) {
var people = this.options.people;
var person = li.data('person');
var index = people.indexOf(person);
people.splice(index, 1);
}
});
var people = [
{firstname: "John", lastname: "Doe"},
{firstname: "Emily", lastname: "Dickinson"},
{firstname: "William", lastname: "Adams"},
{firstname: "Stevie", lastname: "Nicks"},
{firstname: "Bob", lastname: "Barker"}
];
new peopleList('#my-app', { people: people });
Thanks for all answers!
PD: sorry about my bad english u.u