Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class MapsComponent implements OnInit {
- stores: Store[] = [];
- constructor(private storeService: StoreService) {}
- ngOnInit() {
- this.storeService.getStores()
- .subscribe(
- stores => this.stores = stores,
- error => console.error(error)
- );
- console.log(stores);
- var ireLatLng = {lat: 53.1424, lng: -7.6921};
- var map = new google.maps.Map(document.getElementById('map'), {
- zoom: 8,
- center: ireLatLng
- });
- stores.forEach(onAddMarker(stores.firstName,stores.lat,stores.long) {
- console.log(stores.firstName + "added");
- });
- }
- onAddMarker(name: string,lt: string,ln: string){
- var myLatLng = {lat: lt, lng: ln};
- var marker = new google.maps.Marker({
- position: myLatLng,
- map: map,
- title: name,
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement