Skip to content

Instantly share code, notes, and snippets.

View smaillns's full-sized avatar

Smail LOUNES smaillns

View GitHub Profile
// component.ts
myLatLng = { lat: 48.829677, lng: 2.239609 };// Map Options
mapOptions: google.maps.MapOptions = {
center: this.myLatLng,
zoom: 10,
};
markerOptions: google.maps.MarkerOptions = { icon: 'https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi-dotless.png' };
<!-- component.html -->
<google-map [options]="mapOptions" width="100%">
<map-marker
*ngFor="let spot of spots"
[position]="{ lat: spot.lat, lng: spot.lng }"
[options]="markerOptions"
[clickable]="true"
(mapClick)="selectMarker(spot)"
></map-marker>
</google-map>
// component.ts
myLatLng = { lat: 48.829677, lng: 2.239609 }; // Map Options
mapOptions: google.maps.MapOptions = {
center: this.myLatLng,
zoom: 10,
};
markerOptions: google.maps.MarkerOptions = {};
<!-- component.html -->
<google-map [options]="mapOptions" width="100%">
<map-marker *ngFor="let spot of spots"
[position]="{ lat: spot.lat, lng: spot.lng }"
[options]="markerOptions"></map-marker>
</google-map>
<!-- index.html -->
<!doctype html>
<head>
...
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=visualization"></script>
</head>
@smaillns
smaillns / product-gallery.component.ts
Created July 10, 2020 19:23
Pretty simple Image gallery in angular