Hello,
Anyone can help me? I didn’t find a solution in the forum. Maybe it’s helpful for all of us.
I will load multiple departments in multiple ion-cards with inside the google maps of the department.
In my html:
<div *ngFor="let department of departments"> <ion-card> <div style="height: 200px; width: 100%" #mapCanvas id="map{{department.ID}}"></div> <ion-item> <ion-icon name="pin" item-left large></ion-icon> <h2>{{department.name}}</h2> <p>{{department.address}}</p> </ion-item> </ion-card> </div>
The name and the address works. But I didn’t find who I can get the reference to the google maps div.
When it always exists, I can use @ViewChild('map') mapElement: ElementRef;
but now its dynamically
Who can I get the reference to the google maps div in the code to create them and add marker,…
I though by document.getElementById(“map” + [number]). But I think the html page is not loaded when he is at this code because I get the error Cannot read property 'firstChild' of null
.
Thanks in advance.