Google maps api


#1

Hi I have been researching online to find something that loads a map, and will show places. I just can’t get it to work at all. Does anyone have a working example? or somewhere to go to? maps doesn’t even load…


#2

Hi,

I’ve been used it in my very first ionic project. It’s almost 3 years back and not sure if everything is still the same. But anyway here’s the link for your reference:
https://angular-ui.github.io/angular-google-maps/#!/use

And here’re my map html and map-ctrl.js in case you may want to check.

  1. map.html

  2. map-ctrl.js
    (function(){
    ‘use strict’;
    angular.module(‘nkPkgUtlApp’).controller(‘MapCtrl’,[’$scope’,’$stateParams’,‘nkPkgUtlApi’,MapCtrl]);

    function MapCtrl($scope,$stateParams,nkPkgUtlApi){
    var oMemberInfo = angular.fromJson($stateParams.oMemInfo);

     loadMap();
     
     function loadMap(){
         nkPkgUtlApi.getLatLngFromPostal(oMemberInfo.vchPostalCode).then(function(data){
             if(data.status=="OK" || data.status=="ok"){
                 var nLat = data.results[0].geometry.location.lat;
                 var nLng = data.results[0].geometry.location.lng;
                 $scope.map = {center: {latitude: nLat, longitude: nLng}, zoom: 14,pan:1 };
                 $scope.markers = [
                     {
                       "id": "0",
                       "coords": {
                         "latitude": nLat,
                         "longitude": nLng
                       },
                       "window": {
                         "title": oMemberInfo.vchAddress
                       }
                     }
                 ];                     
             }
         });
     };
    

    };
    }());