I am dealing with an array structured like this:
locations: marker[] = [
{id: '1', lat: 51.5239935252832, lng: 5.137663903579778, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker.png'},
{id: '2', lat: 51.523853342911906, lng: 5.1377765563584035, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png'},
{id: '3', lat: 51.5237298485607, lng: 5.137969675407476, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png'},
{id: '4', lat: 51.52355628836575, lng: 5.138066234932012, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png'},
{id: '5', lat: 51.52340275379578, lng: 5.138211074218816, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png'},
{id: '6', lat: 51.523199152806626, lng: 5.138382735595769, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png' },
{id: '7', lat: 51.5229955509073, lng: 5.138511481628484, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png'},
{id: '8', lat: 51.52280529912936, lng: 5.138543668136663, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png'},
{id: '9', lat: 51.523596340777075, lng: 5.138463201866216, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png'},
{id: '700',lat: 51.523372714362736, lng: 5.1386992362595265, content: 'Kids Jungalow (5p)', iconUrl: 'img/marker2.png'},
{id: '101', lat: 51.52329594683302, lng: 5.138838711128301, content: 'Kids Jungalow Giraffe', iconUrl: 'img/marker2.png'}
];
Whenever I click on a marker, a section should open displaying the information of that particular marker.
Below is the HTML code for the google maps:
<sebm-google-map-marker *ngFor="let location of locations" (markerClick)="updateDiv(location)"></sebm-google-map-marker>
Here is the updateDiv() function:
updateDiv(location: Location) {
this.selectedLocation = location;
}
Below is the markup code for the div where I intend to show the id of the selected location:
<div *ngIf="selectedLocation" class="result-number">{{ selectedLocation.id }}</div>
However, it doesn't seem to be functioning correctly!