Skip to content

Commit bdaaf1c

Browse files
committed
Merge pull request angular-ui#1573 from kandizzy/website
modified searchbox example
2 parents 6b13b69 + 52e03d6 commit bdaaf1c

File tree

4 files changed

+65
-16
lines changed

4 files changed

+65
-16
lines changed

app/views/examples/base/base.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<head>
55
<meta charset="utf-8" />
66
<title>AngularJS Plunker</title>
7+
<script src="//maps.googleapis.com/maps/api/js?libraries=weather,geometry,visualization,places&sensor=false&language=en&v=3.20"></script>
78
<script src="../../../vendor/scripts/angular.js" ></script>
89
<script src="../../../vendor/scripts/lodash.js"></script>
910
<script src="../../../vendor/scripts/angular-simple-logger.js"></script>

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
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">
2+
3+
<script id="searchbox.tpl.html" type="text/ng-template">
4+
<input type="text" placeholder="Search">
45
</script>
56
<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options">
67
<ui-gmap-search-box template="searchbox.template" events="searchbox.events"></ui-gmap-search-box>
Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
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+
.controller('mainCtrl', ['$scope', '$log', 'uiGmapGoogleMapApi', function ($scope, $log, GoogleMapApi) {
12+
angular.extend($scope, {
13+
map: {center:
14+
{
15+
latitude: 40.1451,
16+
longitude: -99.6680
17+
},
18+
zoom: 4
19+
},
20+
searchbox: {
21+
template:'searchbox.tpl.html',
22+
events:{
23+
places_changed: function (searchBox) {}
24+
}
25+
},
26+
options: {
27+
scrollwheel: false
28+
}
29+
});
30+
31+
GoogleMapApi.then(function(maps) {
32+
maps.visualRefresh = true;
33+
});
34+
}]);

grunt/options.coffee

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ module.exports =
2525
'autoprefixer'
2626
]
2727

28+
examples:
29+
files: ['<%= yeoman.app %>/views/examples/{,*/}*.*']
30+
tasks: [
31+
'copy:examples'
32+
]
33+
34+
2835
livereload:
2936
options:
3037
livereload: LIVERELOAD_PORT
@@ -228,6 +235,27 @@ module.exports =
228235
dest: '.tmp/styles/'
229236
src: '{,*/}*.css'
230237

238+
examples:
239+
files: [
240+
{
241+
expand: true
242+
cwd: '<%= yeoman.app %>'
243+
dest: '.tmp/'
244+
src: [
245+
'views/examples/{,*/}*.*'
246+
]
247+
}
248+
{
249+
expand: true
250+
cwd: 'dist/vendor/'
251+
dest: '.tmp/vendor'
252+
src: [
253+
'{,*/}*.*'
254+
]
255+
}
256+
]
257+
258+
231259
vendor_fonts:
232260
expand: true
233261
cwd: '<%= yeoman.dist %>/vendor/fonts'
@@ -238,6 +266,7 @@ module.exports =
238266
server: [
239267
'coffee:dist'
240268
'copy:styles'
269+
'copy:examples'
241270
]
242271
test: [
243272
'coffee'

0 commit comments

Comments
 (0)