Plz help
Issue: Not able to display a google map on the page for an ionic android build app using cardova (WORKS FINE ON THE CHROME ie WITHOUT ANDROID BUILD)
Page:
<script id="mapPage.html" type="text/ng-template">
<ion-view title="Map" ng-init="init()" >
<ion-nav-buttons side="left">
<button class="button"> Back </button>
</ion-nav-buttons>
<ion-content>
<div id="map" data-tap-disabled="true"></div>
</ion-content>
</ion-view>
Router:
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('mapPage',
url: '/9',
templateUrl: 'mapPage.html',
controller: 'mapPageTabCtrl'
})
Controller:
.controller('mapPageTabCtrl', function($scope, $timeout, googleAppEngineService, $ionicPopup,
controller_Provider, $ionicLoading, $compile) {
$scope.init= function()
{
var propAddress = $scope.propInfoDetailsObj.prop_address;
var geocoder = new google.maps.Geocoder();
var result = "";
geocoder.geocode( { 'address': propAddress}, function(results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
var myLatlng = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng() );
var mapOptions = {
center: myLatlng,
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var marker = new google.maps.Marker({
map: map,
position: myLatlng
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
$scope.map = map;
}
else
{
result = "Unable to find address: " + status;
console.log("###" + result);
}
})//geocoder.geocode( { 'ad
};
//});// function()
})//controller('mapPageTabCtrl',
PRIOR to android build($ionic build android), tested it on the Chrome browser using tomcat and works fine. I could see google map on the page.
Next,
Using $ionic build android, created an apk file and tested both on AVD emulator and real android phone and notice that the page wont load google map, looks like its ignoring $scope.init= function(){}.
Will appreciate your help...