import { Component , ViewChild , ElementRef } from '@angular/core' ; import { IonicPage , NavController , NavParams } from 'ionic-angular' ; import { GeolocationProvider } from '../../providers/geolocation/geolocation' ; declare var AMap ; @ IonicPage ( ) @ Component ( { selector : 'page-gaodemap' , templateUrl : 'gaodemap.html' , } ) export class GaodemapPage { @ ViewChild ( 'map2' ) map_container2 : ElementRef ; map : any ; constructor ( public navCtrl , public html5Geolocation , public navParams ) { } ionViewDidLoad ( ) { console . log ( 'ionViewDidLoad GaodemapPage' ) ; } ionViewDidEnter ( ) { this . load ( ) ; } load ( ) { this . map = new AMap . Map ( this . map_container2 . nativeElement , { view : new AMap . View2D ( { center : [ this . html5Geolocation . longitude , this . html5Geolocation . latitude ] , zoom : 16 , rotateEnable : true , showBuildingBlock : true } ) } ) ; } }