AnsweredAssumed Answered

Newbie Question

Question asked by David_Bily on May 30, 2014
Latest reply on Jun 2, 2014 by ujjwal_narayan
New to the ArcGIS API for Javascript.  I have been reading and studying a couple of books and code.  Started to write my own application.  I added a couple of basemaps, created a toggle to switch between the two maps (Zoning and aerial photography in our county) and then display parcel outlines on top of Zoning or aerial photography  in either black or yellow depending on the basemap being displayed.  I want to start adding things like a scalebar, TOC, etc. so I read the tutorial on creating your own class and found a couple of really simple examples on the web that would allow me to start adding new functionality into individual javascript files.  One of the examples looks like this:

define('app.sample', [ 'dojo/_base/declare'  ], function(declare) {  return declare({  startup: function() { console.log('I am a defined module'); } }); });

I added one line at the top of this snippet to say:

Console.log(???You are here???);

to ensure that I was getting to this file.  I also changed the first line to read

define(???utils.Sample???, [

as that is where sample.js resides -->??? js/utils/sample.js  I also tried (???utils/Sample???) to no avail.
I then added


to the require statement in my main program and gave it an alias of


Finally, inside the callback function I call Sample with the following two lines of code:

var s = new Sample();    s.startup();

That???s it. Seems pretty straight forward but I always see the verbiage ???You are here??? in the console from the top of Sample.js but never the words ???I am a defined module???.  I also tried putting ???dojo/_base/declare??? in my require statement and referencing it as ???declare??? but that didn???t help either.  What am I doing wrong?  The other code snippet is very similar to this one and I can???t get it to work either. Thanks for any feedback.