【发布时间】:2018-06-29 00:54:52
【问题描述】:
我有 app.module.ts 如何导入自定义 material.ts 模块,但我不能在模块根目录中声明的组件中使用材料。但是当我创建一个子模块(ClientModule)并在这里声明一个组件时,无法识别材料。
@NgModule({
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
LayoutModule,
MaterialModule,
ReactiveFormsModule,
HttpModule,
ClientModule
],
declarations: [
AppComponent,
NavigatorComponent,
LoginComponent,
],
providers: [AuthService],
bootstrap: [AppComponent]
})
export class AppModule { }
ClientRegistrationComponent 不能使用角度材质,我也应该导入材质模块吗?
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ClientRegistrationComponent } from './client-registration/client-registration.component';
@NgModule({
imports: [
CommonModule
],
declarations: [ClientRegistrationComponent]
})
export class ClientModule { }
【问题讨论】:
-
请添加更多详细信息,哪个模块不起作用并发布相关代码
-
抱歉,已添加代码 :)