Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Backbone.Model.extend() is not a function", what have I done wrong?

I am having a crack at Backbone and decided to open a jsFiddle to play around.

Unfortunately, I keep getting this error being thrown:

Backbone.Model.extend is not a function

My code:

var Model = Backbone.Model.extend();

I got this piece of code from a Backbone tutorial.

The fiddle.

What have I done wrong?

like image 821
bundy Avatar asked Sep 22 '11 01:09

bundy


1 Answers

You need to include underscore.js before backbone.js as in this updated version of your fiddle:

http://jsfiddle.net/ambiguous/AFmQ2/1/

From the fine manual:

Backbone's only hard dependency is Underscore.js.

like image 200
mu is too short Avatar answered Nov 18 '22 02:11

mu is too short