Google maps: my map doesn't shown up


#1

Hello,

I am a beginner, i created a project ‘tabs’ type and i wanted to show my maps in the page of account,but it didn’t shown up. .can you help me to solve the probleme please???
this is an article i work with it as a reference:

this is the important part of my code:

controllers.js

.controller('AccountCtrl', function($scope, $ionicLoading) {
 
    google.maps.event.addDomListener(window, 'load', function() {
        var myLatlng = new google.maps.LatLng(37.3000, -120.4833);
 
        var mapOptions = {
            center: myLatlng,
            zoom: 11,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
 
        var map = new google.maps.Map(document.getElementById("map"), mapOptions);
 
        navigator.geolocation.getCurrentPosition(function(pos) {
            map.setCenter(new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude));
            var myLocation = new google.maps.Marker({
                position: new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude),
                map: map,
                title: "My Location"
            });
        });
 
        $scope.map = map;
    });
 
});

tab-account.html

<ion-view view-title="Account">
  <ion-content>
   <div id="map" data-tap-disabled="true"></div>
  </ion-content>
</ion-view>

as for the others things are like the article.(i already tryed the code in a “blank” project and it did work)


#2

Make sure you have installed the latest google maps sdk with valid account key


#3

i’m a little lost here you mean to install it throught the sdk manager o using CLI or somthing else???

in the CLI i already used the command :
"cordova plugin add cordova-plugin-geolocation"
and add on my “index.html” file:

<script src="http://maps.google.com/maps/api/js?key=YOUR_API_KEY_GOES_HERE&sensor=true"></script>

but if you mean throught the sdk manager this is what i already have :

if you mean other thing please say it??


#4

What happens when you open it, do you get any console errors


#5

i was getting this warning:
" Google Maps API warning: SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required "
and i delete sensor=true from the link of maps.

after that i don’t have any probleme in the console.