簡體   English   中英

類型 LeadPage(Module) 是 2 個模塊聲明的一部分

[英]Type LeadPage(Module) is part of the declarations of 2 modules

當我們在ionic-angular(same as a angular)中使用modal時,我們必須在最近的Module.ts中聲明頁面/組件

async onCreateLead() {
    const modal = await this.mdlCntrl.create({
      component: LeadPage
    });
    return await modal.present();   }

我必須在兩個不同的頁面(模塊)中使用上述主要component 當我嘗試在兩個不同的模塊中使用“ LeadPage ”時,會出現錯誤:

LeadPage 類型是 2 個模塊聲明的一部分:

我該如何解決這個問題?

如果您想在許多頁面中將組件用作 model,則需要在更高的模塊中添加。

並生成像 map.component.ts 這樣的組件並生成一個 share.module.ts 並在 share.module.ts 中導出 map.component.ts 在 App.module.ts 中導入 share.module.ts

並在 your.modue.ts 中導入 MapCompoent,如 entryComponents: [MapComponent];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM