Problem in Google Maps Javascript API V3 with MVC Webapp

Asked

Viewed 518 times

3

I want to make a simple Map appear when the user clicks on (Menu>Find), the problem is that the controller receives the data and sends me and does not return the Map.

I am using in my design, MVC standard.

The code, provided in application repository.

  • Do you refer to the red item in the image on the right? It has no relation to Google maps.

  • @bfavaretto I put this image just to show that the files are loaded. That item in red is not the problem. My problem is loading the map.

  • So, it’s difficult to help with this information. We would have to look at all your code in detail until we find the problem. You could isolate the problem and post a small example that reproduces what is occurring?

  • @bfavaretto What do you think, I will edit what I posted isolating just the problem reducing the codes and posting them here. Ok!

1 answer

3


So based on the file that’s in your Github in ' boasaude / Assets / js / controllers / Mapacontroller.js',

I noticed on line 17

'google.maps.Event.addDomListener(window, 'load', initialize);'

After downloading the code I made the following change: I switched to line 17 for a function call and it went like this:

"initialize();"

Note: Why doesn’t it work? window (window) is already loaded so addDomListener’s "initialize" did not start function.

Even so the map did not appear.... but I noticed that the contents inside the one that carries the map had changed...

I did a test by putting height and width and changing the code that was in index.html, thus staying:

<style>
         html, body, #map-canvas {
          /*height: 100%;  Código antigo */
          height: 600px; /* Novo */
          width: 600px; /* Novo */
          margin: 0px;
          padding: 0px
         }
</style>

And there... the map appeared.

I hope it helped.

  • I did what you said and solved! Obg

Browser other questions tagged

You are not signed in. Login or sign up in order to post.