Hello,
I would like to have a map appear on a specific page.
I have already included the entire library on the page in question (poster.page.ts).
import { Component, OnInit } from '@angular/core';
import { HTTP } from '@ionic-native/http/ngx';
import { ActivatedRoute } from '@angular/router';
import { ActionSheetController, Platform, AlertController } from '@ionic/angular';
import { HttpClient } from '@angular/common/http';
import {
GoogleMaps,
GoogleMap,
GoogleMapsMapTypeId,
GoogleMapsEvent,
GoogleMapOptions,
CameraPosition,
MarkerOptions,
Marker,
Environment
} from '@ionic-native/google-maps';
@Component({
selector: 'app-affiche',
templateUrl: './affiche.page.html',
styleUrls: ['./affiche.page.scss'],
})
export class AffichePage implements OnInit {
sub: any;
constructor(
private route:ActivatedRoute,
private http:HTTP,
public alertController:AlertController,
public actionCtrl:ActionSheetController,
private httpclass:HttpClient,
private platform:Platform
) {
if (this.platform.is('cordova')) {
this.loadMap();
}
}
public id: any;
public post: any;
map: GoogleMap;
// Déclaration des principales informations propre à Google Map pour afficher les informations sous forme de carte
loadMap() {
Environment.setEnv({
API_KEY_FOR_BROWSER_RELEASE: 'XXX',
API_KEY_FOR_BROWSER_DEBUG: 'XXX'
});
this.map = GoogleMaps.create('map_canvas', {
camera: {
target: {
lat: 43.610769,
lng: 3.876716
},
zoom: 12,
tilt: 30
}
});
this.map.setMapTypeId(GoogleMapsMapTypeId.SATELLITE);
}
Then here is the full code of the page, and unfortunately my page remains blank.
<ion-card>
<ion-card-content>
<div id="map_canvas"></div>
</ion-card-content>
</ion-card>
Thank’s !