I'm starting to learn BackboneJS. Here is my code :
var TodoItem = Backbone.Model.extend({});
var todoItem = new TodoItem({
description: 'Pick up milk',
status: 'incomplete',
id: 1
});
var TodoView = Backbone.View.extend({
render: function()
{
var html = '<h3>' + this.model.get('description') + '</h3>';
$(this.el).html(html);
}
});
var todoView = new TodoView({ model: todoItem });
todoView.render();
console.log(todoView.el);
But I get this error :
Uncaught TypeError: Expecting a function in instanceof check, but got undefined
_.extend._setElement @ backbone.js:1233
_.extend.setElement @ backbone.js:1222
_.extend._ensureElement @ backbone.js:1302
Backbone.View @ backbone.js:1170
child @ backbone.js:1831
(anonymous function) @ (index):28
What am I doing wrongly ? I don't really understand where I need to create the function it's waiting for.