I’m new to Backbone and I’m trying to get a basic view rendered using Underscore’s templating. Here’s the javascript:
TestView = Backbone.View.extend({
initialize: function() {
this.render();
},
render: function() {
var template = _.template( $('#template').html(), {} );
this.el.html( template );
}
});
var test_view = new TestView( { el: $('#container') } );
This is the error I’m getting in Chrome:
Uncaught TypeError: Expecting a function in instanceof check, but got [object Object]
It’s throwing the error from Backbone on line 1203 (development version). You can see the error in action at my website.
What am I doing wrong here? Should I omit the render() function?
Change the loading order, i.e. jQuery first: