本文介绍了页面有一个@IonicPage装饰器,但它没有相应的“NgModule”装饰器。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Ionic的页面导航工作。使用 ionic serve 后,我收到此错误:

I was working on page navigation in Ionic. After using ionic serve, I got this error:

扩展名为.ts的网页有一个@IonicPage装饰器,但它没有相应的NgModule

任何人都可以解释我收到此错误的原因。

Can anyone explain why I am getting this error.

推荐答案

这是因为 @IonicPage()装饰器用于深度链接,这将在离子深度链接系统中注册页面。

This is because the @IonicPage() decorator is for deep linking, this will register the page in ionic's deep link system.

如果您不想在该页面上进行深层链接,可以删除装饰器。

You can remove the decorator if you don't want deep link on that page.

或者您可以在您的网页上注册该页面 YOURPAGE.module.ts 使用以下代码:

Or you can register that page in your YOURPAGE.module.ts with this code:

@NgModule({
  declarations: [
    MyPage
  ],
  imports: [
    IonicPageModule.forChild(MyPage)
  ],
  entryComponents: [
    MyPage
  ]
})

您可以在

这篇关于页面有一个@IonicPage装饰器,但它没有相应的“NgModule”装饰器。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 07:50