Menu icon Foundation
Google Map in an App

I am embedding a Google Map inside a template page.
Map JS is stored inside a js file in my asset folder.
It is being pulled in using "onload" e.g.:
div id="map-canvas" onload="loadMap();"

This works when the page is reloaded in the browser,
but not when viewing the app as the page does not reload.

I tried using ng-include to load in the entire html block for the Google Map,
thinking that that might cause the content to be reloaded but that’s not working.

Is there a way to load content into a page and have it re-initialize, like what happens when you refresh the browser?

I am just using the standard controllers as I am not a js expert.

From looking online into "Angular JS Google Map" I see people have solved the problem using ng-if.
Is there something like this in Foundation-Apps.

I am just using the standard controllers as I am not a js expert.

From looking online into "Angular JS Google Map" I see people have solved the problem using ng-if.
Is there something like this in Foundation-Apps.

foundation-appsappsgoogle mapangular

I am embedding a Google Map inside a template page.
Map JS is stored inside a js file in my asset folder.
It is being pulled in using "onload" e.g.:
div id="map-canvas" onload="loadMap();"

This works when the page is reloaded in the browser,
but not when viewing the app as the page does not reload.

I tried using ng-include to load in the entire html block for the Google Map,
thinking that that might cause the content to be reloaded but that’s not working.

Is there a way to load content into a page and have it re-initialize, like what happens when you refresh the browser?

I am just using the standard controllers as I am not a js expert.

From looking online into "Angular JS Google Map" I see people have solved the problem using ng-if.
Is there something like this in Foundation-Apps.

I am just using the standard controllers as I am not a js expert.

From looking online into "Angular JS Google Map" I see people have solved the problem using ng-if.
Is there something like this in Foundation-Apps.

Jeanie Chung over 4 years ago

Hey Kieran-

You could try the execute your function right after you declare it in your controller, so your div will look something like

and your controller will look like

angular.module('yourApp', [])
    .controller('YourController', ['$scope', function($scope) {
      $scope.loadMap = function() {
         ...
      };
      $scope.loadMap();

}]);

Alternatively, you could also use an event binder:

angular.module('yourApp', [])
    .controller('YourController', ['$scope', function($scope) {
      $scope.loadMap = function() {
          .....
      };
      $scope.$on('$viewContentLoaded', function() {
         $scope.loadMap();
       });
}]);

See if that works!

Kieran Mahon over 4 years ago

Hi Jeanie,
many thanks for your reply, only seeing it now!!
We got the map issue working, using a workaround,
but not in the way you said,
which is probably the better way to do it.

I will try your solution, but I really dont understand what to do with the controller?

Also, is there a section missing from your comment i.e. "...so your div will look something like"

thanks again, Kieran

iOS man about 2 years ago

I just embedded a Google Map in vshare & Apptoko just check the source code to understand.

iOS man almost 2 years ago

TowelRoot app

qooapp app may be it can slove your problem.

Rabin Sharma almost 2 years ago

Thanks for your contribution, I am looking for this article timely. I am very happy to read it because it can give me more insight, thank you. SHARE it for PC

iOS man almost 2 years ago

tweakbox

tweakbox

i think this app can help you . hope you love it

iOS man almost 2 years ago

Love your blog man 192.168.l.254

iOS man over 1 year ago

Hi Jeanie, 
many thanks for your reply, only seeing it now!!
We got the map issue working, using a workaround, 
but not in the way you said,
which is probably the better way to do it.

I will try your solution, but I really dont understand what to do with the controller?

Also, is there a section missing from your comment i.e. "...so your div will look something like"

thanks again, Kieran 

 

i strongly agreed with comment 

 

independence day sms 

 

Nizam Khan over 1 year ago

Thanks for your contribution, I am looking for this article timely. I am very happy to read it because it can give me more insight, Thanks..asphalt 8 cheats

anita sharma over 1 year ago

This app is easily available on Google Play Store from where you can easily download it and install it to your device, the only thing is that it is a paid app for which you have to pay some amount of charges to avail the unlimited fun.psiphon 3