2017-01-10 13 views
0

現在の位置を示すマーカー(このライブラリを使用して - >https://github.com/allenhwkim/angularjs-google-maps)をGoogle Mapsウェブページに表示しようとしています。これがコントローラです。ngMapで現在位置のGoogleマップを表示

export class SearchCtrl implements ISearchCtrl { 
    longitude: number; 
    latitude: number; 

    constructor(public StartLoadingService: IStartLoadingService, 
       public LoginService: ILoginService, 
       public NgMap) { 

     this.longitude = 9.191383; 
     this.latitude = 45.464211; 

     navigator.geolocation.getCurrentPosition(this.setLocations.bind(this)); 
    } 

    setLocations(position): void { 
     this.longitude = position.coords.longitude; 
     this.latitude = position.coords.latitude; 
    } 
} 

NgMapでマーカーを配置してその位置にジャンプする機能がありますか?あなたがposition属性のcurrent-locationを指定して設定することができ、その目的のために

おかげで、

ナノ

答えて

0

centeredtrueへ:

<marker centered="true" position="current-location" ></marker> 

Demo