Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to Create Backbone View
    text
    copied!<p>I'm continually getting <code>index.js:7 Uncaught TypeError: Cannot read property 'View' of null</code>, which indicates that Backbone is not loaded/present, however, when I review the loaded resources on the page backbone-min.js is present.</p> <p>Since there are no 404 errors, I believe the issue is with the script itself. Does anyone see any issues with the script below?</p> <p><strong>NOTE:</strong> For convenience I uploaded my code <a href="http://www.filefactory.com/file/cfe1d6f/n/sample.zip" rel="nofollow">here</a>. The zip file contains all the relevant js files. If you scroll to the bottom of the webpage, you should see a "slow download" button, once you click it you'll be prompted to enter a captcha code. After entering the code, the actual download button (under the "slow download" button) will appear within a few seconds. </p> <p><strong>View: index.js</strong></p> <pre><code>define([ "jQuery", "Underscore", "Backbone" // I've tried using the modules above as well as direct loading using order! as seen in the following lines. //"order!libs/jquery/jquery-min", //"order!libs/underscore/underscore-min", //"order!libs/backbone/backbone-min", ], function($, _, Backbone){ console.log(_) // prints "undefined" console.log(Backbone) // prints Object var IndexView = Backbone.View.extend({ // At this line I now get: Uncaught TypeError: Cannot call method 'extend' of undefined render: function(){ $(this.el).html("&lt;h1&gt;Welcome Dan!&lt;/h1&gt;"); $("body").html(this.el); } }); return new IndexView(); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload