错误错误:未捕获(在承诺中):无效链接:SosPopPage [英] ERROR Error: Uncaught (in promise): invalid link: SosPopPage

查看:204
本文介绍了错误错误:未捕获(在承诺中):无效链接:SosPopPage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个SOS页面,当我点击我希望它显示这样一个弹出页面的按钮时。然后用户可以选择电话号码。

I am coding a SOS page, when I click the button that I want it showing a popup page like this. Then user can choose phone number.

sos.html page

<button ion-button color="light" (click)="openSosPop()">Call</button>

sos.ts page

openSosPop() {
  this.openModal('SosPopPage');
  // let contactModal = this.modalCtrl.create(SosPopPage);
  // contactModal.present();
}

openModal(pageName) {
  this.modalCtrl.create(pageName, null, { cssClass: 'inset-modal' })
    .present();
}

sos.css page

ion-modal.inset-modal {
  // transparent black background overlay
  background-color: rgba(0, 0, 0, .5) !important;
  transition: opacity .25s ease-in-out;
  padding: 20vh 10vw;
}


推荐答案


我没有使用延迟加载

I am not using lazy loading

如果你没有使用延迟加载,它不是< a href =https://ionicframework.com/docs/api/navigation/IonicPage/ =nofollow noreferrer> IonicPage
添加IonicPage装饰器允许您使用字符串名称来处理页面。

If you are not using lazy loading, it is not an IonicPage. Adding IonicPage decorator allows you to use string names to handle pages.


这将自动创建一个指向MyPage组件的链接与类相同的名称,名称:'MyPage'。现在可以使用此名称导航到该页面。

This will automatically create a link to the MyPage component using the same name as the class, name: 'MyPage'. The page can now be navigated to by using this name.

由于你没有延迟加载,你不能使用字符串来导航或创建模态和弹出窗口。您必须使用实际的页面/组件。

Since you are not lazy loading, you cannot use a string to navigate or create modals and popups. You have to use the actual page/component.

导入页面。

import <path_to_page>;

  this.openModal(SosPopPage);//create the modal.

这篇关于错误错误:未捕获(在承诺中):无效链接:SosPopPage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆