This repository was archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 106
/
Copy pathproperty-binding.html
69 lines (63 loc) · 2.89 KB
/
property-binding.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html>
<html ng-app="esri-map-example">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Property Binding</title>
<!-- load Esri CSS -->
<link rel="stylesheet" type="text/css" href="//js.arcgis.com/4.0/esri/css/main.css">
<style type="text/css">
.esri-view {
height: 400px;
}
</style>
</head>
<body>
<h2>Property Binding</h2>
<div ng-controller="ExampleController as exampleCtrl">
<p>These properties are updated directly by the MapView:</p>
<ul>
<li><strong>Lat:</strong> {{ exampleCtrl.mapView.center.latitude | number:3 }}, <strong>Lng:</strong> {{ exampleCtrl.mapView.center.longitude | number:3 }}</li>
<li><strong>Scale:</strong> {{ exampleCtrl.mapView.scale | number:2 }}</li>
<li><strong>Zoom:</strong> {{ exampleCtrl.mapView.zoom | number:2 }}</li>
</ul>
<p>This property can be changed by interacting with the input form <strong>and</strong> the MapView:</p>
<ul>
<li><strong>Rotation:</strong> <input type="number" ng-model="exampleCtrl.mapView.rotation" /></li>
</ul>
<esri-map-view map="exampleCtrl.map" on-create="exampleCtrl.onViewCreated"
view-options="{
zoom: 11,
center: [-6.66, 62.23]
}">
</esri-map-view>
</div>
<!-- load Esri JavaScript API -->
<script src="//js.arcgis.com/4.0/"></script>
<!-- load Angular -->
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.js"></script>
<!-- load angular-esri-map directives -->
<script src="lib/angular-esri-map.js"></script>
<!-- run example app controller -->
<script type="text/javascript">
angular.module('esri-map-example', ['esri.map'])
.controller('ExampleController', function(esriLoader, $scope) {
var self = this;
esriLoader.require('esri/Map', function(Map) {
// Create the map
self.map = new Map({
basemap: 'satellite'
});
});
this.onViewCreated = function(view) {
self.mapView = view;
// Setup a JSAPI 4.x property watch outside of Angular
// and update bound Angular controller properties.
self.mapView.watch('center,scale,zoom,rotation', function() {
$scope.$applyAsync('exampleCtrl.mapView');
});
};
});
</script>
</body>
</html>