使用2个页面的模态-错误-Ionic 4

问题描述 投票:0回答:1

我创建了一个模态并将其命名为worksmodal

它从页面showworks打开。一切正常。

[新要求-我也必须从Notificatons页面打开相同的模式,因此我也从那里调用了它。

问题:现在它正在从Notifications page打开,当我尝试从showworks page打开时,它给出了错误-

WorksmodalPage is part of the declarations of 2 modules: NotificationsPageModule and ShowworksPageModule! Please consider moving WorksmodalPage to a higher module that imports NotificationsPageModule and ShowworksPageModule.

您需要注意的几件事-

  1. 当应用打开时,默认情况下会打开Dashboard page并调用Notification popover page,然后依次调用worksmodal page

  2. showworks page从也叫worksmodal page的菜单中打开。错误出现在这里

  3. worksmodal.module.ts禁用的十进制]

    // declarations: [WorksmodalPage]

  4. 现在如果我从WorksmodalPage的声明中删除showworks.module.ts,它会给出错误-

WorksmodalPage is not part of any NgModule or the module has not been imported into your module.

我需要怎么做才能在两个页面上都起作用?

我创建了一个模式并将其命名为workmodal。它从页面showworks中打开。一切正常。新要求-我也必须从“通知”页面打开相同的模式,因此我从...

angular ionic-framework ionic2 ionic3 ionic4
1个回答
0
投票

将模态组件的声明移到其自己的模块中,并确保将其导出到该模块中。然后将该模块导入到您正在使用它的页面中。

© www.soinside.com 2019 - 2024. All rights reserved.