Search code examples
javascriptbackbone.jsmarionette

Still getting uncaught TypeError even after including underscore


I've looked and seen the messages about putting underscore before backbone and marionette. I've done that. When I run my sample I still get:

Uncaught TypeError: Cannot read property 'extend' of undefined at MessageDetailsView.js:1

I'm not trying to instantiate the view, so it doesn't seem that I would need a model yet.

I'm trying to convert my html/jquery to marionette and this is my start. Once I get the ItemView to load, then I will see if I can put it in a CollectionView or just add directly to a div.

Any thoughts?

main.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html">

<head>
    <title>Gmail API Quickstart</title>
    <meta charset='utf-8' />
</head>

<body>
<script src="jquery.js" type="text/javascript"></script>
<script src="underscore_1_8_3.js" type="text/javascript"></script>
<script src="backbone.js" type="text/javascript"></script>
<script src="backbone.radio.js" type="text/javascript"></script>
<script src="backbone.marionette_3_2_0.js" type="text/javascript"></script>
<script src="bootstrap.js" type="text/javascript"></script>
<link href="bootstrap.css" rel="stylesheet">

<script src="MessageDetailsView.js" type="text/javascript"></script>


<script type="text/javascript">
    alert("Start");
</script>

</body>
</html>

MessageDetailsView.js

var MessageDetailsView = Marionette.ItemView.extend({

});

Solution

  • Version 3.2.0 of Marionette doesn't have an Marionette.ItemView class, it has been replaced by Marionette.View, see docs.

    Use v2.4.7 if you want the ItemView class.