I am having a problem with google maps, when i enter the page on first load it pushes the markers to the map, if i leave the map and then re-enter the page it doesn’t load the map markers…
here is my add map code below:
constructor(public navCtrl: NavController,
public maps: GoogleMapsProvider,
public platform: Platform,
public locations: LocationsProvider,
public popoverCtrl: PopoverController,
public apiProvider: ApiProvider) {
this.apiProvider.getShops().subscribe(shops => {
this.shops = shops;
});
}
ionViewWillEnter() {
this.platform.ready().then(() => {
this.apiProvider.getShops().subscribe(shops => {
this.shops = shops;
let mapLoaded = this.maps.init(this.mapElement.nativeElement, this.pleaseConnect.nativeElement);
let locationsLoaded = this.locations.load();
Promise.all([
mapLoaded,
locationsLoaded
]).then((result) => {
//let locations = result[1];
for (let shop of this.shops) {
this.maps.addMarker(parseFloat(shop.Latitude), parseFloat(shop.Longitude), shop.Name, shop.Website, shop.Logo,
shop.OpenMon, shop.OpenTue, shop.OpenWed, shop.OpenThu, shop.OpenFri, shop.OpenSat, shop.OpenSun,
shop.AddressLine1, shop.Postcode, shop.City, '1', '1');
}
});
});
});
}