var map, webmapId = "1a40fa5cc1ab4569b79f45444d728067"; require([ "esri/map", "esri/arcgis/utils", "esri/dijit/Legend", "dojo/domReady!" ], function (Map, arcgisUtils, Legend) { arcgisUtils.createMap(webmapId, "mapDiv").then(function (response) { map = response.map ; var legend = new Legend({ map: map, layerInfos:(arcgisUtils.getLegendLayers(response)) }, "legendDiv"); legend.startup(); }); });
I'm trying the second basic tutorial : https://developers.arcgis.com/en/javascript/jstutorials/intro_agstemplate_amd.html
The code doesn't work, even in the sandbox : http://developers.arcgis.com/en/javascript/sandbox/sandbox.html?sample=map_webmap (map is blank)
I've tested it with IE9 and FF24 ; same results !
Where is the problem ? Sample codes aren't right ?
Thanks for your help.
Alex.
<!DOCTYPE html> <html> <head> <title>Create a Web Map</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.7/js/esri/css/esri.css"> <style> html,body,#mapDiv,.map.container{ padding:0; margin:0; height:100%; } #legendDiv{ background-color: #fff; position: absolute !important; z-index: 99; top:10px; right:20px; } </style> <script>var dojoConfig = { parseOnLoad:true };</script> <script src="http://js.arcgis.com/3.7compact/"></script> <script> var map, webmapId = "1a40fa5cc1ab4569b79f45444d728067"; require([ "esri/map", "esri/arcgis/utils", "esri/dijit/Legend", "dojo/domReady!" ], function (Map, arcgisUtils, Legend) { arcgisUtils.createMap(webmapId, "mapDiv").then(function (response) { map = response.map; var legend = new Legend({ map: map, layerInfos:(arcgisUtils.getLegendLayers(response)) }, "legendDiv"); legend.startup(); }); }); </script> </head> <body> <div id="mapDiv"></div> <div id="legendDiv"></div> </body> </html>