How to call custom function after ngSwitch new view is created

Yes :relaxed: , see this SO item: https://stackoverflow.com/questions/36427670/angular2-calling-custom-function-after-ngswitch-new-view-is-created

Finally how I resolved this is by, by providing a (change)=“onSegmentChanged($event)” on ion-segment element.

Which will trigger whenever ion-segment will switch. And I am able to access the dom element with id googleMapAllFobs when its getting switched to value=“map”.

Provided a checking in onSegmentChanged function, before call load google map function, to ensure the current view contains div to load google map.

Looks very easy for this current requirement.

1 Like