made looping markers
This commit is contained in:
parent
1eb79aa047
commit
b59351addf
2 changed files with 29 additions and 1 deletions
|
@ -22,7 +22,16 @@
|
||||||
[zoom]="zoom"
|
[zoom]="zoom"
|
||||||
[scaleControl]="true"
|
[scaleControl]="true"
|
||||||
(idle)="viewBoundsChanged($event)">
|
(idle)="viewBoundsChanged($event)">
|
||||||
<agm-marker [latitude]="lat" [longitude]="lng"></agm-marker>
|
<agm-marker
|
||||||
|
*ngFor="let m of markers"
|
||||||
|
[latitude]="m.lat"
|
||||||
|
[longitude]="m.lng"
|
||||||
|
[label]="m.label">
|
||||||
|
|
||||||
|
<agm-info-window>
|
||||||
|
<strong>{{m.label}}</strong>
|
||||||
|
</agm-info-window>
|
||||||
|
</agm-marker>
|
||||||
</agm-map>
|
</agm-map>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -15,6 +15,25 @@ export class MapComponent implements OnInit {
|
||||||
|
|
||||||
dataReceived: string = 'yes';
|
dataReceived: string = 'yes';
|
||||||
|
|
||||||
|
markers = [
|
||||||
|
{
|
||||||
|
lat: 54.0466,
|
||||||
|
lng: -2.8007,
|
||||||
|
label: 'A',
|
||||||
|
|
||||||
|
},
|
||||||
|
{
|
||||||
|
lat: 54.0453,
|
||||||
|
lng: -2.83,
|
||||||
|
label: 'B'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
lat: 54.0563,
|
||||||
|
lng: -2.8279,
|
||||||
|
label: 'C'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
map: any;
|
map: any;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|
Reference in a new issue