无法读取undefined的属性映射

时间:2018-04-26 05:54:54

标签: typescript ionic-framework

您好我正在学习离子3,我正在练习在离子应用程序中添加地图但我收到错误

  

无法读取未定义的属性映射



export class LocationsPage {

  @ViewChild('map') mapref : ElementRef;
map : any;
  constructor(public navCtrl: NavController, public navParams: NavParams) {
  }

  ionViewDidLoad() {
    this.dispMap();
  }
 
  dispMap(){
  let coords = new google.maps.latlng('17.512511','78.352228');
  let mapoptions = { 
center : coords,
zoom : 14,
mapTypeId : google.maps.mapTypeId.ROADMAP
    };
    this.map = new google.maps.Map(this.mapref.nativeElement,mapoptions);
}

}

    #my-map{
    height: 100% !important;
}

<ion-content>

<div #map id="my-map"></div>

</ion-content>
&#13;
&#13;
&#13;

0 个答案:

没有答案