|
| 1 | +<!doctype html> |
| 2 | +<html ng-app="myapp"> |
| 3 | + <head> |
| 4 | +<script src="https://code.angularjs.org/1.2.25/angular.js"></script> |
| 5 | +<script src="http://maps.google.com/maps/api/js"></script> |
| 6 | +<!-- build:js scripts/ng-map.min.js --> |
| 7 | +<script src="../app/scripts/app.js"></script> |
| 8 | +<script src="../app/scripts/directives/map_controller.js"></script> |
| 9 | +<script src="../app/scripts/directives/map.js"></script> |
| 10 | +<script src="../app/scripts/directives/marker.js"></script> |
| 11 | +<script src="../app/scripts/directives/shape.js"></script> |
| 12 | +<script src="../app/scripts/directives/info-window.js"></script> |
| 13 | +<script src="../app/scripts/directives/map-lazy-load.js"></script> |
| 14 | +<script src="../app/scripts/services/geo_coder.js"></script> |
| 15 | +<script src="../app/scripts/services/navigator_geolocation.js"></script> |
| 16 | +<script src="../app/scripts/services/attr2_options.js"></script> |
| 17 | +<!-- endbuild --> |
| 18 | +<script> |
| 19 | +var app = app || angular.module('myapp', ['ngMap']); |
| 20 | +app.controller('MyCtrl', function($scope, $compile) { |
| 21 | + $scope.stores = { |
| 22 | + foo: { position:[41, -87], items: [1,2,3,4]}, |
| 23 | + bar:{ position:[41, -83], items: [5,6,7,8]} |
| 24 | + }; |
| 25 | + $scope.showStore = function(evt, id) { |
| 26 | + $scope.store = $scope.stores[id]; |
| 27 | + $scope.showInfoWindow.apply(this, [evt, 'foo']); |
| 28 | + }; |
| 29 | +}); |
| 30 | +</script> |
| 31 | + </head> |
| 32 | + <body> |
| 33 | + |
| 34 | + <div ng-controller="MyCtrl"> |
| 35 | + <map center="41,-87" zoom="3"> |
| 36 | + |
| 37 | + <info-window id="foo"> |
| 38 | + <div ng-non-bindable=""> |
| 39 | + Lat/Lng: {{this.getPosition()}}<br/> |
| 40 | + <ul> |
| 41 | + <li ng-repeat='item in store.items'>{{item}}</li> |
| 42 | + </ul> |
| 43 | + </div> |
| 44 | + </info-window> |
| 45 | + |
| 46 | + <marker ng-repeat="(id, store) in stores" id="{{id}}" |
| 47 | + position="{{store.position}}" |
| 48 | + on-click="showStore(event, id)" |
| 49 | + ></marker> |
| 50 | + |
| 51 | + <info-window id="bar"> |
| 52 | + <div ng-non-bindable=""> |
| 53 | + Lat: {{this.getPosition().lat()}}<br/> |
| 54 | + Lng: {{this.getPosition().lng()}}<br/> |
| 55 | + </div> |
| 56 | + </info-window> |
| 57 | + |
| 58 | + <marker position="41, -79" on-click="showInfoWindow('bar')" /> |
| 59 | + </map> |
| 60 | + </div> |
| 61 | + |
| 62 | + </body> |
| 63 | +</html> |
0 commit comments