Skip to content

Commit fa299b8

Browse files
committed
modified searchbox example
1 parent d3e115d commit fa299b8

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

app/views/examples/search-box/index.html

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<div id="map_canvas" ng-controller="mainCtrl">
2-
<script type="text/ng-template" id="searchbox.tpl.html">
3-
<input type="text" placeholder="Search Box">
4-
</script>
52
<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options">
63
<ui-gmap-search-box template="searchbox.template" events="searchbox.events"></ui-gmap-search-box>
74
</ui-gmap-google-map>
Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
11
angular.module('appMaps', ['uiGmapgoogle-maps'])
2-
.config(function(uiGmapGoogleMapApiProvider) {
3-
uiGmapGoogleMapApiProvider.configure({
4-
// key: 'your api key',
5-
v: '3.20', //defaults to latest 3.X anyhow
6-
libraries: 'places' // Required for SearchBox.
7-
});
8-
})
9-
.controller('mainCtrl', function ($scope, $log) {
10-
$scope.map = {center: {latitude: 40.1451, longitude: -99.6680 }, zoom: 4 };
11-
$scope.options = {scrollwheel: false};
12-
var events = {
13-
places_changed: function (searchBox) {}
14-
}
15-
$scope.searchbox = { template:'searchbox.tpl.html', events:events};
2+
3+
.config(['uiGmapGoogleMapApiProvider', function (GoogleMapApi) {
4+
GoogleMapApi.configure({
5+
// key: 'your api key',
6+
v: '3.20',
7+
libraries: 'places'
168
});
9+
}])
10+
11+
.run(['$templateCache', function ($templateCache) {
12+
$templateCache.put('searchbox.tpl.html', '<input type="text" placeholder="Search">');
13+
}])
14+
15+
.controller('mainCtrl', ['$scope', '$log', 'uiGmapGoogleMapApi', function ($scope, $log, GoogleMapApi) {
16+
17+
angular.extend($scope, {
18+
map: {center:
19+
{
20+
latitude: 40.1451,
21+
longitude: -99.6680
22+
},
23+
zoom: 4
24+
},
25+
searchbox: {
26+
template:'searchbox.tpl.html',
27+
events:{
28+
places_changed: function (searchBox) {}
29+
}
30+
},
31+
options: {
32+
scrollwheel: false
33+
}
34+
});
35+
36+
GoogleMapApi.then(function(maps) {
37+
maps.visualRefresh = true;
38+
});
39+
}]);

0 commit comments

Comments
 (0)