javascript - Google Maps not working on Angular JS after changing view -


i making mobile app using cordova angular js , google maps api. on home screen have 3 tabs. third tab integration google maps. first time enter on third tab, map load , runs perfect. but, when change view has controller , go view , controller of google maps, won't load.

here code run everytime change tab 3 (where google maps).

$rootscope.mapoptions = {     center: new google.maps.latlng(-18.894608, -48.260980),     zoom: 14,     maptypeid: google.maps.maptypeid.roadmap };   $rootscope.map = new google.maps.map(document.getelementbyid("map-canvas"), $rootscope.mapoptions); 

here html of view

<div id="map-canvas" style="height: 90%; width: 100%"></div> 

i stuck on problem , appreciate. obs: if need more information code, ask. thanks!

wrap map-canvas div under ng-if condition, work definitely.

<div ng-if="showmap" id="map-canvas" style="height: 90%; width: 100%"></div> 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -