当我提交按钮时,显示错误。错误是“无法读取未定义的属性'getPosition'”。如果有人能帮助我,我将非常感激。 这是我的代码
this.map.on(GoogleMapsEvent.MY_LOCATION_BUTTON_CLICK).subscribe((map: GoogleMap) => {
if (this.isViewLoaded) {
this.map.getCameraPosition().then((camera: CameraPosition) => {
let target: LatLng = <LatLng> camera.target;
this.marker.setPosition(target);
});
}
});
this.marker.getPosition().then(position => {
this.place.location = position;
this.place.save().then(place => {
this.showContentView();
this.translate.get('PLACE_ADDED').subscribe(str => this.showToast(str));
}, error => {
this.showContentView();
this.translate.get('ERROR_PLACE_ADD').subscribe(str => this.showToast(str));
});
});