angular - Angular2: ngIf without destroying component -


i have web page tab control taking portion of screen. tabs shown/hidden using *ngif , comparing selected tab against enum. components destroyed / created every time user changes tabs.

usually fine, 1 of tabs contains bing map. every time tab selected map control reloaded - causing map briefly display current ip location until desired location , pins loaded (a fraction of second later).

the way able around stop using *ngif tab , instead set custom style:

.hide { height: 0px; overflow: hidden; }

so far appears work great, concerned give rise bugs down road.

is there angular2 blessed way hide component without destroying component?

thanks.

the [hidden] property looking for. more or less replaced ng-show / ng-hide in angular2.

https://angular.io/docs/ts/latest/cookbook/a1-a2-quick-reference.html#!#ng-show


Comments