This repository has been archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
map load event called when using a web map
check if map is loaded (i.e. created from a web map) and call load handler updated the web map test and example pages as follows: 1) use the map load event to get a handle to the map (instead of esriRegistry) 2) load the Extent module up front 3) added comments I also removed the whole hiding/showing the item snippet from the example to get rid of some of the noise. fixes #75
- Loading branch information
Showing
6 changed files
with
81 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
'use strict'; | ||
|
||
angular.module('esri-map-docs') | ||
.controller('WebMapCtrl', function($scope, esriLoader, esriRegistry) { | ||
$scope.map = { | ||
center: { | ||
lng: -122.6819, | ||
lat: 45.5200 | ||
}, | ||
zoom: 13 | ||
}; | ||
$scope.goToBookmark = function(bookmark) { | ||
esriRegistry.get('myMap').then(function(map) { | ||
esriLoader.require('esri/geometry/Extent').then(function(Extent) { | ||
var extent = new Extent(bookmark.extent); | ||
map.setExtent(extent); | ||
}); | ||
}); | ||
}; | ||
.controller('WebMapCtrl', function($scope, esriLoader) { | ||
// get a reference to the controller | ||
// for use within the callback | ||
var self = this; | ||
// this example requires the extent module | ||
// so let's go ahead and load that now | ||
esriLoader.require('esri/geometry/Extent').then(function(Extent) { | ||
$scope.map = { | ||
center: { | ||
lng: -122.6819, | ||
lat: 45.5200 | ||
}, | ||
zoom: 13 | ||
}; | ||
// get a reference to the map object once it's loaded | ||
$scope.mapLoaded = function(map) { | ||
self.mapObj = map; | ||
}; | ||
// click handler for bookmark buttons | ||
$scope.goToBookmark = function(bookmark) { | ||
if (!self.mapObj) { | ||
return; | ||
} | ||
var extent = new Extent(bookmark.extent); | ||
self.mapObj.setExtent(extent); | ||
}; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters