【发布时间】:2021-01-07 20:32:07
【问题描述】:
我是 Ionic 的新手,正在开发 Ionic 应用程序。当用户设备位置关闭时,我确实在页面中显示了警报消息。此警报消息工作正常。现在我的要求是在警报消息单击确定时将应用程序重定向到不同的页面(home.page.html)。我用 return this.homePage 但它不起作用。我想我需要编写一些函数来将其重定向到家。下面是我的代码。
location.ts 页面:
ngOnInit() {
this.helperService.showLoader("Fetching your location");
this.mapElement = this.mapElement.nativeElement;
this.getUserLocation()
.then((res) => {
this.myLocation = res;
this.helperService.hideLoader();
return this.myLocation;
})
.catch((error) => {
console.log('Error getting location', error);
this.helperService.hideLoader();
alert(
"Location setting should be ON to use this feature, please turn it ON in the Location Settings on your phone "
);
return this.homePage;
})
请帮助我如何做到这一点。谢谢
【问题讨论】: