模块'ComponentsModule'声明的意外值'DecoratorFactory'

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

我已经找到了一个解决我的问题的项目,但是我觉得我正在遵循建议,并且问题仍然存在。

我正在尝试在多个页面上使用组件

我真的不明白我的代码有什么问题。

components.module.ts

import {NgModule} from '@angular/core';
import {PrincipalHeaderComponent} from './principal-header/principal-header.component';

@NgModule({
    declarations: [ PrincipalHeaderComponent, NgModule ],
    exports: [ PrincipalHeaderComponent ]
})
export class ComponentsModule {}

home.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { HomePage } from './home.page';
import {AppointmentComponent} from '../../components/views/appointment/appointment.component';
import {ComponentsModule} from '../../components/components.module';

const routes: Routes = [
  {
    path: '',
    component: HomePage
  }
];

@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        IonicModule,
        ComponentsModule,
        RouterModule.forChild(routes)
    ],
    declarations: [HomePage, AppointmentComponent]
})
export class HomePageModule {}

planning.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { PlanningPage } from './planning.page';
import {ComponentsModule} from '../../components/components.module';

const routes: Routes = [
  {
    path: '',
    component: PlanningPage
  }
];

@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        IonicModule,
        ComponentsModule,
        RouterModule.forChild(routes),
    ],
  declarations: [PlanningPage]
})
export class PlanningPageModule {}

enter image description here

angular typescript ionic-framework module components
1个回答
0
投票

确定,通过在我的components.module.ts的声明中删除NgModule来解决它>

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