Hiding Google Maps when not needed


I am using google maps using JS e.g.
<div #mapElement class="map"></div>

I am also using the following


      <div [hidden]=segment_selected_hidden_Configuration>

When i use <div #mapElement class="map"></div> in side this hidden element, google maps does not get displayed.

Is there a way to hide the map screen when not needed?