|
7 | 7 | <script src="../bower_components/Leaflet.awesome-markers/dist/leaflet.awesome-markers.js"></script> |
8 | 8 | <link rel="stylesheet" href="../bower_components/leaflet-dist/leaflet.css" /> |
9 | 9 | <link rel="stylesheet" href="../bower_components/Leaflet.awesome-markers/dist/leaflet.awesome-markers.css"> |
| 10 | + <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css"> |
| 11 | + <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap-theme.min.css"> |
10 | 12 | <script> |
11 | 13 | angular.module("demoapp", ["leaflet-directive"]); |
12 | 14 | function DemoController($scope) { |
|
19 | 21 | markers: { |
20 | 22 | m1: { |
21 | 23 | lat: 51.505, |
22 | | - lng: -0.09 |
| 24 | + lng: -0.09, |
| 25 | + focus: true, |
| 26 | + draggable: false, |
| 27 | + message: "Hi there!", |
| 28 | + icon: {} |
23 | 29 | } |
24 | 30 | }, |
25 | | - iconA: { |
26 | | - iconUrl: 'http://cdn.leafletjs.com/leaflet-0.5.1/images/marker-icon.png' |
27 | | - }, |
| 31 | + iconA: {}, |
28 | 32 | iconB: { |
29 | | - iconUrl: 'http://leafletjs.com/docs/images/leaf-orange.png', |
30 | | - shadowUrl: 'http://leafletjs.com/docs/images/leaf-shadow.png', |
| 33 | + iconUrl: 'img/leaf-orange.png', |
| 34 | + shadowUrl: 'img/leaf-shadow.png', |
31 | 35 | iconSize: [38, 95], |
32 | 36 | shadowSize: [50, 64], |
33 | 37 | iconAnchor: [22, 94], |
34 | 38 | shadowAnchor: [4, 62] |
35 | 39 | }, |
36 | | - iconC: L.AwesomeMarkers.icon({ |
37 | | - icon: 'cofee', |
38 | | - color: 'red' |
39 | | - }), |
40 | | - iconD: L.AwesomeMarkers.icon({ |
| 40 | + iconC: { |
| 41 | + type: 'awesomeMarker', |
41 | 42 | icon: 'cofee', |
42 | | - color: 'green' |
43 | | - }) |
| 43 | + markerColor: 'red' |
| 44 | + } |
44 | 45 | }); |
45 | 46 | $scope.$on('leafletDirectiveMarker.click', function(e, args) { |
46 | 47 | // Args will contain the marker name and other relevant information |
|
56 | 57 | }); |
57 | 58 | }; |
58 | 59 | </script> |
| 60 | + <style> |
| 61 | + html,body { |
| 62 | + height: 100%; |
| 63 | + } |
| 64 | + .angular-leaflet-map { |
| 65 | + margin-top: 20px; |
| 66 | + height: 100%; |
| 67 | + } |
| 68 | + .fullheight { |
| 69 | + height: 100%; |
| 70 | + } |
| 71 | + </style> |
59 | 72 | </head> |
60 | 73 | <body ng-controller="DemoController"> |
61 | | - <leaflet center="london" markers="markers" height="480px" width="640px"> |
62 | | - </leaflet> |
63 | | - <label>Lat: <input ng-model="markers.m1.lat" type="number"></label> |
64 | | - <label>Lon: <input ng-model="markers.m1.lng" type="number"></label> |
65 | | - <br/> |
66 | | - <label>Popup: <input ng-model="markers.m1.message" type="text"></label> |
67 | | - <input type="radio" ng-model="markers.m1.message" ng-value="null" name="mess"> null value |
68 | | - <input type="radio" ng-model="markers.m1.message" ng-value="123" name="mess"> not a string |
69 | | - <br/> |
70 | | - Draggable: |
71 | | - <input type="radio" ng-model="markers.m1.draggable" ng-value="true" name="drag"> Yes |
72 | | - <input type="radio" ng-model="markers.m1.draggable" ng-value="false" name="drag"> No |
73 | | - <input type="radio" ng-model="markers.m1.draggable" ng-value="'error'" name="drag"> Not a boolean value |
74 | | - <input type="radio" ng-model="markers.m1.draggable" ng-value="null" name="drag"> null value |
75 | | - <br/> |
76 | | - Focus: |
77 | | - <input type="radio" ng-model="markers.m1.focus" ng-value="true" name="focus"> Yes |
78 | | - <input type="radio" ng-model="markers.m1.focus" ng-value="false" name="focus"> No |
79 | | - <input type="radio" ng-model="markers.m1.focus" ng-value="'error'" name="focus"> Not a boolean value |
80 | | - <input type="radio" ng-model="markers.m1.focus" ng-value="null" name="focus"> null value |
81 | | - <br/> |
82 | | - Icon: |
83 | | - <input type="radio" ng-model="markers.m1.icon" ng-value="iconA" name="icon"> Default |
84 | | - <input type="radio" ng-model="markers.m1.icon" ng-value="iconB" name="icon"> Other (Leaflet Icon) |
85 | | - <input type="radio" ng-model="markers.m1.icon" ng-value="iconC" name="icon"> Red (AwesomeMarker Icon) |
86 | | - <input type="radio" ng-model="markers.m1.icon" ng-value="iconD" name="icon"> Green (AwesomeMarker Icon) |
87 | | - <input type="radio" ng-model="markers.m1.icon" ng-value="'error'" name="icon"> Not a icon |
88 | | - <input type="radio" ng-model="markers.m1.icon" ng-value="null" name="icon"> null value |
| 74 | + <div class="container fullheight"> |
| 75 | + <div class="row"> |
| 76 | + <h1>Dynamic update marker properties</h1> |
| 77 | + <div class="col-md-5"> |
| 78 | + <form role="form" class="form-horizontal"> |
| 79 | + <h3>Marker position</h3> |
| 80 | + <input ng-model="markers.m1.lat" type="number"> |
| 81 | + <input ng-model="markers.m1.lng" type="number"> |
| 82 | + |
| 83 | + <h3>Popup text</h3> |
| 84 | + <div class="btn-group" data-toggle="buttons"> |
| 85 | + <label class="btn btn-primary" ng-class="{ active: markers.m1.focus == true }"> |
| 86 | + <input type="radio" name="focus" ng-click="markers.m1.focus=true;" />Focus |
| 87 | + </label> |
| 88 | + <label class="btn btn-primary" ng-class="{ active: markers.m1.focus == false }"> |
| 89 | + <input type="radio" name="focus" ng-click="markers.m1.focus=false;" />Not focus |
| 90 | + </label> |
| 91 | + </div> |
| 92 | + <br /><br /> |
| 93 | + Popup message: <input ng-model="markers.m1.message" type="text"></label> |
| 94 | + <h3>Draggable</h3> |
| 95 | + <div class="btn-group" data-toggle="buttons"> |
| 96 | + <label class="btn btn-primary" ng-class="{ active: markers.m1.draggable == true }"> |
| 97 | + <input type="radio" name="draggable" ng-model="markers.m1.draggable" ng-value="true" />Draggable |
| 98 | + </label> |
| 99 | + <label class="btn btn-primary" ng-class="{ active: markers.m1.draggable == false }"> |
| 100 | + <input type="radio" name="draggable" ng-model="markers.m1.draggable" ng-value="false" />Not draggable |
| 101 | + </label> |
| 102 | + </div> |
| 103 | + <h3>Icon</h3> |
| 104 | + <div class="btn-group" data-toggle="buttons"> |
| 105 | + <label class="btn btn-primary" ng-class="{ active: markers.m1.icon == iconA }"> |
| 106 | + <input type="radio" ng-model="markers.m1.icon" ng-value="iconA" class="btn btn-default">Default</button> |
| 107 | + </label> |
| 108 | + <label class="btn btn-primary" ng-class="{ active: markers.m1.icon == iconB }"> |
| 109 | + <input type="radio" ng-model="markers.m1.icon" ng-value="iconB" class="btn btn-default">Leaflet Icon</button> |
| 110 | + </label> |
| 111 | + <label class="btn btn-primary" ng-class="{ active: markers.m1.icon == iconC }"> |
| 112 | + <input type="radio" ng-model="markers.m1.icon" ng-value="iconC" class="btn btn-default">AwesomeMarker Icon Red</button> |
| 113 | + </label> |
| 114 | + </div> |
| 115 | + </form> |
| 116 | + </div> |
| 117 | + <div class="col-md-4"> |
| 118 | + <leaflet center="london" markers="markers" height="480px" width="640px"></leaflet> |
| 119 | + </div> |
| 120 | + </div> |
| 121 | + </div> |
89 | 122 | </body> |
90 | 123 | </html> |
0 commit comments