lundi 29 décembre 2014

How to reference the ArcGIS Server JS API using RequireJS


When using RequireJS to load a JavaScript library from a CDN, an example syntax is shown at https://github.com/requirejs/example-jquery-cdn:



requirejs.config({
"paths": {
"jquery": "//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min"
}
});


How should the ArcGIS Server JS API be referenced? The page at https://developers.arcgis.com/javascript/ gives the syntax for a standard web page:



<script src="http://js.arcgis.com/3.12/"></script>


but when using RequireJS:



requirejs.config({
'paths': {
'arcgis': '//js.arcgis.com/3.12/'
}
});


this returns NetworkError: 404 Not Found - http://js.arcgis.com/3.12/.js


What is the correct syntax for referencing the ArcGIS Server JS API when using RequireJS?





Aucun commentaire:

Enregistrer un commentaire