大佬教程收集整理的这篇文章主要介绍了在Angular Google Map中应该有多个时只显示一个标记,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是HTML部分:
<agm-map [latitude]="lat" [longitude]="long" [zoom] = 16> <agm-marker *ngFor="let m of latlongs; let i = index" [latitude]="m.lat" [longitude]="m.long" [markerDraggable]="m.draggable"></agm-marker> </agm-map>
this.service.getData().subscribe(data => { let json: anY[] = []; json["data"] = data.json().map(it => { it["category"] = "LOCATIOn"; it["gallery"] = ["../assets/img/area.png"]; return it; }); for(let i = 0; i < json["data"].length; i++){ this.mapInfos.push({lat: +json["data"][i].lat,long: +json["data"][i].long}); } this.latlongs = this.mapInfos; });
我正在为我的项目使用角度4
然后在此代码部分中附加for循环:
<agm-marker [latitude]="51.673858" [longitude]="7.815982"></agm-marker>
latitude] =“51.673858”[经度] =“7.815982”>
以上是大佬教程为你收集整理的在Angular Google Map中应该有多个时只显示一个标记全部内容,希望文章能够帮你解决在Angular Google Map中应该有多个时只显示一个标记所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。