Note that there are some explanatory texts on larger screens.

plurals
  1. POBackbone not defined with require js
    text
    copied!<p>I'm getting Model not defined error with below code. I've added underscore, jquery, backbone etc but I can only get object returned with console.log function for jquery only <code>$</code></p> <p>Is there a reason why other objects are not returning inside define function?</p> <p>Below is my code from main.js:</p> <pre><code>require.config({ paths: { jquery: '//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min', underscore: '//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min', backbone: '//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min', bootstrap: '//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min', qunit: '//cdnjs.cloudflare.com/ajax/libs/qunit/1.11.0/qunit.min', bootstrapDatepicker: '/js/bootstrap-datepicker', backboneValidation: '//cdnjs.cloudflare.com/ajax/libs/backbone.validation/0.7.1/backbone-validation-min' } }); define([ 'jquery', 'underscore', 'backbone', 'bootstrap', 'qunit', 'bootstrapDatepicker', 'backboneValidation' ], function($, _, Backbone, Bootstrap, Qunit, Datepicker, backboneValidation){ $(function(){ var ReportModel = Backbone.Model.extend({ validation: { 'date.from': { required: true, msg: 'Please enter a from date' }, 'date.to': { required: true, msg: 'Please enter a to date' } }, initialize: function(){ console.log('test'); } }); $('#dp3').datepicker().on('changeDate', function(e){ $('#toDate').datepicker('setStartDate', new Date(e.date.valueOf())); }); $('#dp4').datepicker().on('changeDate', function(e){ $('#fromDate').datepicker('setEndDate', new Date(e.date.valueOf())); }); }); }); </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