運行命令下面的工作原理: ionic cordova build ios
離子3模塊聲明錯誤
但在以下錯誤
Error: Type ExpandableHeaderComponent in /Users/jobstore/jobstore/js/src/components/expandable-header/expandable-header.ts is part of the declarations of 2 modules: SharedModuleComponent in /Users/jobstore/jobstore/js/src/components/shared-module/shared-module.ts and ExpandableHeaderComponentModule in /Users/jobstore/jobstore/js/src/components/expandable-header/expandable-header.module.ts! Please consider moving ExpandableHeaderComponent in /Users/jobstore/jobstore/js/src/components/expandable-header/expandable-header.ts to a higher module that imports SharedModuleComponent in /Users/jobstore/jobstore/js/src/components/shared-module/shared-module.ts and ExpandableHeaderComponentModule in /Users/jobstore/jobstore/js/src/components/expandable-header/expandable-header.module.ts. You can also create a new NgModule that exports and includes ExpandableHeaderComponent in /Users/jobstore/jobstore/js/src/components/expandable-header/expandable-header.ts then import that NgModule in SharedModuleComponent in /Users/jobstore/jobstore/js/src/components/shared-module/shared-module.ts and ExpandableHeaderComponentModule in /Users/jobstore/jobstore/js/src/components/expandable-header/expandable-header.module.ts.
我試圖創建共享模塊運行以下
ionic cordova build ios --prod
結果:
import { Component ,NgModule} from '@angular/core';
import {ExpandableHeaderComponent} from '../expandable-header/expandable-header';
import {ShrinkHeaderComponent} from '../shrink-header/shrink-header';
@Component({
selector: 'shared-module',
templateUrl: 'shared-module.html'
})
@NgModule({
declarations: [
ExpandableHeaderComponent,
ShrinkHeaderComponent
],
exports: [
ExpandableHeaderComponent,
ShrinkHeaderComponent
]
})
export class SharedModuleComponent {
constructor() {
}
}
和app.module.ts
其導入這裏
import { SharedModuleComponent } from '../components/shared-module/shared-module';
這裏
imports: [
BrowserModule,
HttpModule,
SharedModuleComponent,
],
,但我仍然面臨着同樣的問題。
聲明它。你的錯誤正好說明你應該做什麼。這裏不清楚什麼? – yurzui
你可以顯示你的ComponentsModule嗎? – brijmcq
@yurzui,你可以請你幫我理解 – noor