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数据。我有我的控制台日志中的这些数据:
我想知道如何访问这些数据并使用它在我的地图上绘制多个不同的标记。