2015-05-19 91 views
0

我已經使用了uiGmapGoogleMapApi NOT WORKING標記infowindow數組。你可以幫我嗎?沒有問題,但正在添加不工作Angularjs uiGmapGoogleApi信息窗口不工作?

<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="options"> 
    <ui-gmap-markers models="markers" idkey="markers.id" coords="'coords'" click=" 
           onClick()" events="markers.events" > 
            <ui-gmap-window options="windowOptions" closeClick="closeClick()"> 
             <div>{{title}}</div> 
          </ui-gmap-window> 
           </ui-gmap-markers> 
    </ui-gmap-google-map> 

Script.file

angular.module('appMaps', ['uiGmapgoogle-maps']) 
    .controller('mainCtrl', function($scope, $log) { 
     $scope.map = {center: {latitude: 40.1451, longitude: -99.6680 }, zoom: 4 } 
     $scope.options = {scrollwheel: false}; 
     $scope.markers = [{ 
      coords: { 
       latitude: 40.1451, 
       longitude: -99.6680 
      }, 
      id: 0 
     } 
     ]; 

     $scope.windowOptions = { 
      visible: false 
     }; 

     $scope.onClick = function() { 
      $scope.windowOptions.visible = !$scope.windowOptions.visible; 
     }; 

     $scope.closeClick = function() { 
      $scope.windowOptions.visible = false; 
     }; 

     $scope.title = "Window Title!"; 
    }); 

+1

定義_ 「不工作」 _更精確地請。 – duncan

回答

0

我已經解決了我的問題。 Documenation

<ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" data-smart-map-instance="demoMap" options="options"> 

           <ui-gmap-markers models="markers" idkey="markers.id" coords="'coords'" click=" 
           onClick()" events="markers.events" > 

            <ui-gmap-windows show="show" closeClick="closeClick()"> 
             <div ng-non-bindable>{{id}}</div> 
            </ui-gmap-windows> 
           </ui-gmap-markers> 

           </ui-gmap-google-map> 

腳本文件

$scope.markers = []; 
    var data={ 
           id: i, 
           coords: { 
            latitude: 11.897890789, 
            longitude: 78.6786876.lng 
           }, 
           data: 'house' 
         }; 
         $scope.markers.push(data); 
$scope.map = { 
          center: { 
           latitude: $scope.markers[0].coords.latitude, 
           longitude: $scope.markers[0].coords.longitude 
          }, 
         zoom: 9 
        }; 

        $scope.options = { 
          scrollwheel: true, 
          disableDefaultUI: true, 
          zoomControl: true, 
          scaleControl: true, 
          // streetViewControl: true 
        };