Angular2 calling custom function after ngSwitch new view is created

后端 未结 3 1507
粉色の甜心
粉色の甜心 2020-11-30 14:23

I am creating a small app using Angular2+Ionic2. In this app I want initialise google-map into view segment when user

3条回答
  •  温柔的废话
    2020-11-30 15:03

    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.

提交回复
热议问题