I have a web page with a tab
control taking up a portion of the screen. The tabs are shown/hidden using *ngIf
and comparing the selected tab against an enum
. Thus the components are destroyed / created every time the user changes tabs.
Usually this is fine, but one of the tabs contains a Bing map
. Every time the tab is selected the map control is reloaded - causing the map to briefly display the current IP location
until the desired location and pins are loaded (a fraction of a second later).
The only way I was able to get around this was to stop using *ngIf
for that tab and instead set a custom style:
.hide { height: 0px; overflow: hidden; }
So far this appears to work great, but I am concerned that this will give rise to bugs down the road.
Is there an angular2 blessed way to hide a component without destroying the component?
Thanks.