简体   繁体   English

错误错误:未捕获(承诺):无效链接:SosPopPage

[英]ERROR Error: Uncaught (in promise): invalid link: SosPopPage

I am coding a SOS page, when I click the button that I want it showing a popup page like this. 我正在编码一个SOS页面,当我单击希望它显示这样的弹出页面的按钮时。 Then user can choose phone number. 然后,用户可以选择电话号码。

在此处输入图片说明

sos.html page sos.html页面

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

sos.ts page sos.ts页面

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 sos.css页面

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 我没有使用延迟加载

If you are not using lazy loading , it is not an IonicPage . 如果您没有使用延迟加载 ,则它不是IonicPage Adding IonicPage decorator allows you to use string names to handle pages. 添加IonicPage装饰器使您可以使用字符串名称来处理页面。

This will automatically create a link to the MyPage component using the same name as the class, name: 'MyPage'. 这将使用与该类相同的名称自动创建指向MyPage组件的链接,名称为“ 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 the page. 导入页面。

import <path_to_page>;

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM