1
1
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'
16
8
} ) ;
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