define(["dojo/_base/declare", "core_library/_Widget", "esri/map"], function (declare, WidgetBase, myMap) { return declare([WidgetBase], { _map: null, postCreate: function () { this._map = new esri.Map(this.domNode, { extent:initExtent,slider: true }); } }); });
Solved! Go to Solution.
Hi All,
I wanted to know in following code why we have to instantiate map as new esri.Map() and not as new myMap()define(["dojo/_base/declare", "core_library/_Widget", "esri/map"], function (declare, WidgetBase, myMap) { return declare([WidgetBase], { _map: null, postCreate: function () { this._map = new esri.Map(this.domNode, { extent:initExtent,slider: true }); } }); });
define(["dojo/_base/declare", "core_library/_Widget", "esri/map","dijit/form/Button"],
function (declare, WidgetBase, myMap,Button) {
return declare([WidgetBase], {
_map: null,
postCreate: function () {
/*
where Button is a local varibale.Now we can use new Button() to instantiate button
instead of new dijit.form.Button()
*/
var myButton = new Button({
label: "Click me!",
onClick: function(){}
}, "someNode");
/*
but for map although we have local variable named myMap,following does not work
*/
this._map = new myMap(this.domNode, { extent:initExtent,slider: true });
//following works
this._map=new esri.Map(this.domNode, { extent: initExtent, slider: true });
}
});
});