我希望用户点击此标签here,然后系统会将其定向到Google地图,并在其中说明地址。我确实在这个名为' startExternalMap()'的标签上有一个onclick功能,但我遇到了一些我不理解的错误,而且我不知道如何解决它。 Here is the error! All of the underline have the same error。我该如何解决?
这是我的html文件here!
的代码这是我的onclick函数的ts文件中的代码。
@Component({
selector: 'page-order',
templateUrl: 'info.html'
})
export class OrderInfoPage {
order: Order;
moment;
from: boolean = true;
constructor(private alertCtrl: AlertController, private request: ApiRequest, private userData: UserData, public navCtrl: NavController, private params: NavParams, private drivers: DriverData, public plt: Platform, private user: User, private modalCtrl: ModalController, private viewCtrl: ViewController) {
this.request.showLoading();
this.order = this.params.get('order');
this.moment = moment;
this.plt.ready().then(()=>{
let status = this.order.status_id;
//if from is false updateStatus not working
let id = ['102','301','311','321'];
for(let i in id){
if(status == id[i]){
this.from = false;
}
}
});
this.drivers.drivers_data.length>0 ? 0 : this.drivers.getDrivers();
}
startExternalMap() {
if (this.location.latitude){
this.platform.ready().then(() => {
Geolocation.getCurrentPosition().then((position) => {
// android
if (this.platform.is('android')) {
window.open('geo://' + position.coords.latitude + ',' + position.coords.longitude + '?q=' + this.location.latitude + ',' + this.location.longitude + '(' + this.location.name + ')', '_system');
};
});
});
};
}
答案 0 :(得分:1)
您已在构造函数中将Platform定义为public plt: Platform
。因此,您应该致电this.plt
而不是this.platform
。此外没有this.location
所以你应该先定义它。首先解决这些错误并进行检查。