【发布时间】:2020-02-18 05:23:36
【问题描述】:
我创建了一个加载器组件,并尝试在我的页面中使用。问题是它在一个页面中工作正常,但是当我在其他页面中使用时,它显示错误
component is part of the declarations of 2 modules: AppModule in
这是我的第一页 category.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { LoaderComponent } from '../loader/loader.component'; //this is component i am using
import { IonicModule } from '@ionic/angular';
import { CategoryPageRoutingModule } from './category-routing.module';
import { CategoryPage } from './category.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
CategoryPageRoutingModule
],
declarations: [CategoryPage, LoaderComponent]
})
export class CategoryPageModule {}
我的另一个法师 login.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { LoaderComponent } from '../loader/loader.component'; //this is component
import { LoginPageRoutingModule } from './login-routing.module';
import { LoginPage } from './login.page';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
LoginPageRoutingModule,
],
declarations: [LoginPage, LoaderComponent]
})
export class LoginPageModule {}
现在,如果我从第二页中删除我的组件,它工作正常。在 app.module.ts 中,我在声明数组中添加了我的组件。
【问题讨论】:
标签: angular ionic-framework ionic4