2016-07-21 56 views
1

我正在開發一個帶有angularjs的web應用程序。Angular Google Maps - 如何給地圖添加方向

在我的應用程序中,我想介紹一個包含標記和方向的Google地圖。 對於標記它很容易,因爲我們有「ui-gmap-marker」指令。問題是,我沒有找到任何指令的「方向」。 如何在我的標記之間添加方向?

  <ui-gmap-google-map center="map.center" zoom="map.zoom" draggable="true" options="map.options" bounds="map.bounds" events="map.events"> 
      <ui-gmap-drawing-manager options="drawingManagerOptions" control="drawingManagerControl" events="eventHandler"> 
      <div ng-repeat="marker in markers track by $index"> 
       <ui-gmap-marker coords="marker.coords" options="marker.options" events="marker.events" idkey="marker.markerFirebaseKey"> 
        <ui-gmap-window options="marker.window.options"> 
        <div> 
         <div class="blue large">{{marker.title}}</div> 
         <div class="orange medium">{{marker.description}}</div> 
        </div> 
        </ui-gmap-window> 
       </ui-gmap-marker> 
      </div><!-- end of marker --> 
      </ui-gmap-drawing-manager> 
      </ui-gmap-google-map> 

謝謝先進。

+0

你檢查了嗎?但可能不是更好的解決方案。 http://www.honobono-life.info/wpeng/directions-service-waypoints/ – Namal

+0

我更喜歡用angular-google-map擴展。我的問題是,如果有一種方法來處理角度谷歌地圖擴展方向。 http://angular-ui.github.io/angular-google-maps/#!/ – user4550050

回答

1

我試過ui-gmap-google-map查找路線。但目前還沒有可用的功能。

但是你可以使用這個庫包含每個功能。 http://ngmap.github.io

這裏是marker指令。 http://ngmap.github.io/#/!marker-simple.html

<ng-map center="-25.363882,131.044922" zoom="4"> 
     <marker position="-25.363882,131.044922" title="Hello World!"> </marker> 
    </ng-map> 

這裏是方向指令。 http://ngmap.github.io/#/!directions.html

<ng-map zoom="14" center="37.7699298, -122.4469157" style="height:90%" on-click="logLatLng()" > 
     <directions 
      draggable="true" 
      panel="directions-panel" 
      travel-mode="{{travelMode}}" 
      waypoints="{{wayPoints}}" 
      origin="{{origin}}" 
      destination="{{destination}}"> 
     </directions> 
     </ng-map> 
+0

我可以在兩個擴展之間合併嗎? – user4550050

+0

我不這麼認爲。但爲什麼? – Namal

+0

我已經使用地圖和標記的angualr-google-map擴展。所以如果我想使用ngMap,我需要替換它們。 – user4550050