Chris
Chris

Reputation: 737

Error when creating a simple Backbone Model using Backbone 0.9.10

I am trying to create a very simple Backbone Model and I am consistently getting an error.

<script src="/dugoutServices/js/jquery-1.4.2.min.js"></script>
<script src="http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.4/underscore-min.js"</script>
<script src="/dugoutServices/js/backbone.js"></script>

<script type="text/javascript">
var Team = Backbone.Model.extend({});
</script>

This throws the following error:

TypeError: 'undefined' is not a function (evaluating '_.has(protoProps, 'constructor')')

The Backbone docs say this function is looking to see if the constructor property was overridden, if not it uses the default parent constructor. For some reason it is having an issue when searching for this constructor property.

I have tried adding an initialize() method and that did not work. This simple code worked when using Backbone 0.3.3. Any thoughts?

Upvotes: 0

Views: 196

Answers (2)

Cianan Sims
Cianan Sims

Reputation: 3429

change

<script src="http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.4/underscore-min.js"</script>

to

<script src="http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.4/underscore-min.js"></script>

You're missing a >.

Upvotes: 0

jungy
jungy

Reputation: 3087

It seems that the version of underscore you're using doesn't have the _.has method. If you update your version of underscore it should run fine.

Upvotes: 1

Related Questions