Since Backbone uses jQuery under the hood to work with the DOM, we can reuse much of the code from our jQuery application. We'll be using the same ArcGIS JavaScript API modules to interact with the map services. We'll only change how the drop-down options are rendered and how the change events on those dropdowns are handled. So, let's start by making a copy of our jQuery application and naming the folder Backbone
.
Next, we'll need to add references to the Backbone and Underscore libraries in our dojoConfig
, so that they are available through AMD. We'll load them from a CDN source for this application, although you're free to download them into folders for your own applications:
dojoConfig = { async: true, packages: [ … { name: "jquery", location: "http://ajax.googleapis.com/ajax/libs/jquery/1.11.2", main: "jquery" }, { name: "underscore", location: "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0", ...