I am using the requirejs
domReady
plugin within my code like this:
1.Config for module:
requirejs.config({
baseUrl:'scripts',
paths:{
async:'lib/plugins/async',
domReady:'lib/plugins/domReady'
}
});
2.Actual module
require(['domReady!','./gmaps','./gmaps_controls'],function(gmaps,controls){
//get mapdiv here by id
//create controls from controls module here...
});
I get the error:
GET http://localhost:8180/lib/plugins/domReady.js 404 (Not Found) require.js:34
Uncaught Error: Script error for: domReady
http://requirejs.org/docs/errors.html#scripterror require.js:8
This is my file strcuture within the scripts
folder:
./lib:
plugins require.js
./lib/plugins:
async.js domReady.js
UPDATE2:
I load requirejs
like this:
<script type="text/javascript" data-main="scripts/gmaps_displayScenario" src="scripts/lib/require.js"></script>
This is working for me:
requirejs.config({
baseUrl:'scripts',
paths:{
async:'lib/plugins/async',
domReady:'lib/plugins/domReady'
}
});
require(['domReady!','./gmaps','./gmaps_geoJSON'],function(domReady,gmaps,geoJSON){
//code goes on
I did this because I use jQuery only for the $(document).ready()
function and for making ajax
calls...I did not want to load the whole library for this. However this is not working as specified here.