angularmapsagm

Angular agm map not rendering when using [mapTypeId]


I have a component which is basically a agm map. It works perfectly showing markers, circles and stuff, but now I am introducing the [mapTypeId] property and it is not working anymore. It shows the markers, but the whole map is not rendering. It seems as when it is loading, but nothing happens.


Solution

  • I did not understand why it is not working but I found a way that works properly. I used @viewchild from the TypeScript file to set that property there:

    @ViewChild(AgmMap, { static: true }) mapa!: AgmMap;
    

    And then on the ng OnInit I setted the MapTypeId: this.mapa.mapTypeId='ROADMAP'