0
我想在我的本地Ionic 2應用程序的地圖上放置多個標記。Ionic 2 Angular 2谷歌地圖從數據庫座標添加多個標記
//Connecting to locations database
this.db.connect();
let locations = this.db.collection('locations');
//Retrieving all the locations of users from database
locations.fetch().subscribe(msg => console.log(msg));
//loop through all the locations, adding markers at each position
for (let i = 0; i < 10; i++) {
let pin = locations[i];
let location: any;
let marker = new google.maps.Marker({
map: this.map,
animation: google.maps.Animation.DROP,
position : {"lat": 2433, "lng": 234}
});
//Content displayed in window on Map
let content =
//User profile information
'<h3>Name: </h3>' + this.user.details.name +
'<h3>Email: </h3>' + this.user.details.email +
'<h3>Image: </h3>' + '<img src='+this.user.details.image+'>' +
'<button id="sendRequest()" (click)>Request Walk</button>';
this.addInfoWindow(marker, content);
}
//end of locations loop
此刻,長和數字是由座標組成的。我有一個位置數據庫,其中包含用戶電子郵件,lat和lng數據。我有我的控制檯日誌中的這些數據:
我想知道如何訪問這些數據並使用它在我的地圖上繪製多個不同的標記。