Consider this markup
<div id="controls" class="controls"> <a href="#">Home</a> - <a href="#/get">get</a> - <a href="#/new">new</a> <input type="text" val="" id="input"> </div>
And this piece of javascript:
$(document).ready(function() { "use strict"; // this is used on my code as root.App, // but the code was omitted here for clarity purposes var root = this, undefined; var controller = Backbone.Controller.extend({ routes : { // static }, }); var view = new Backbone.View.extend({ el : $('#controls'), events : { 'click a' : 'updateOnEnter' }, updateOnEnter : function(el) { alert('sss'); return this; }, initialize : function() { _.bindAll(this, 'render', 'updateOnEnter'); }, render : function() { return this; } }); new view; new controller; Backbone.history.start(); )};
When view
is called (with new view
), Firebug fires this error:
parent.apply is not a function error backbone.js (line 1043): child = function(){ return parent.apply(this, arguments); };
Any ideas to why this is happening? Thanks.
Never mind.
The problem is on line 16 of the above js code:
var view = new Backbone.View.extend({
it should instead be:
var view = Backbone.View.extend({
I'm not deleting this question since somebody may find it useful. The pitfalls of not coming from a CS background, I guess.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With