2015-04-30 152 views
0

我已經在這個角度指令的Marker API guide讀到的一切,但我不能顯示在地圖上的標記。角谷歌,地圖不顯示標記在地圖上

這裏的HTML代碼:

<ui-gmap-google-map center='map.center' zoom="map.zoom" draggable="false" options="options"> 
    <ui-gmap-markers models="marker.id" coords="marker.coords" icon="marker.options.icon"></ui-gmap-markers> 
</ui-gmap-google-map> 

,這是處理地圖對象,所述控制器:

angular.module( 'twoSpecials') .controller( 'MapCtrl',函數($範圍,uiGmapGoogleMapApi){

$scope.map = { 

    center: { 
     latitude : 45.5674402, 
     longitude: 12.4277687 
    }, 
    zoom: 15   
} 

$scope.options = {scrollwheel: false, 
        styles: [ 
          { 
          "featureType": "landscape.natural", 
          "stylers": [ 
           { "saturation": 100 }, 
           { "weight": 0.1 }, 
           { "hue": "#0077ff" }, 
           { "color": "#f5f5dc" } 
          ] 
          } 
          ], 
        disableDefaultUI: true, 
       }; 

$scope.marker = { 
    id : 0, 
    coords : { 
     latitude : 45.5674402, 
     longitude: 12.4277687 
    }, 
    options: { 
     icon: 'images/marker.jpg' 
    } 

} 
    }); 

由於我使用Yeomann,我已經建立使用該工具的角度應用程序,我已經把標記圖標中的「圖片」文件夾Yeomann創造。我必須將圖像放入另一個文件夾嗎?我是否以錯誤的方式使用此指令?

回答

0

你的UI-GMAP的標誌圖標的屬性是不正確。試試icon =「marker.options.icon」。

+0

不顯示,即使在這種情況下。你有任何線索嗎? –

+0

嗯你能提供一個小提琴嗎? – gerl