In my code, i have a div named #map that will displayed after a condition from a for loop.
<div *ngFor="let message of fullMessagesArr">
<div *ngIf="message.replyMap">
<div #gmap style="width:100px;height:400px"></div>
</div>
</div>
My .ts file given below with initMap function.
@ViewChild('gmap') gmapElement: ElementRef;
map: google.maps.Map;
initGMap = () => {
const mapProp = {
center: new google.maps.LatLng(6.9404, 79.8464),
zoom: 15,
mapTypeId: google.maps.MapTypeId.satellite
};
this.map = new google.maps.Map(this.gmapElement.nativeElement, mapProp);
}
initGMap function is getting called inside sendMessage function.
fullMessagesArrset? Either it's not set, or it's empty, or none of the messages get thereplyMapproperty set