angular – 模块’AppModule’声明的意外模块’MdAutocompleteModule’.请添加@ Pipe / @ Directive / @ Component注释

前端之家收集整理的这篇文章主要介绍了angular – 模块’AppModule’声明的意外模块’MdAutocompleteModule’.请添加@ Pipe / @ Directive / @ Component注释前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
安装角度材料后,我在角度4项目中出现此错误

unexpected module ‘MdAutocompleteModule’ declared by the module ‘AppModule’. Please add a @Pipe/@Directive/@Component annotation.

这是我的app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';


import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { environment } from './../environments/environment';

import { AngularFireModule } from 'angularfire2';
// New imports to update based on AngularFire2 version 4
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { AngularFireAuthModule } from 'angularfire2/auth';

// import material
import { CdkTableModule } from '@angular/cdk';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import {
  FullscreenOverlayContainer,MdAutocompleteModule,MdButtonModule,MdButtonToggleModule,MdCardModule,MdCheckBoxModule,MdChipsModule,MdCoreModule,MdTableModule,MdDatepickerModule,MdDialogModule,MdExpansionModule,MdGridListModule,MdIconModule,MdInputModule,MdListModule,MdMenuModule,MdNativeDateModule,MdPaginatorModule,MdProgressBarModule,MdProgressSpinnerModule,MdRadioModule,MdRippleModule,MdSelectModule,MdSidenavModule,MdSliderModule,MdSlideToggleModule,MdSnackBarModule,MdSortModule,MdTabsModule,MdToolbarModule,MdTooltipModule,OverlayContainer,StyleModule
} from '@angular/material';



export const MaterialModules = [
    MdAutocompleteModule,StyleModule
  ];

@NgModule({
  declarations: [
    AppComponent,MaterialModules
  ],imports: [
    BrowserModule,FormsModule,HttpModule,AngularFireModule.initializeApp(environment.firebaseConfig),AngularFireDatabaseModule,// imports firebase/database,only needed for database features
    AngularFireAuthModule,// imports firebase/auth only needed for auth features
    BrowserAnimationsModule,CdkTableModule
  ],providers: [],bootstrap: [AppComponent]
})
export class AppModule { }
您没有导入该模块
declarations: [
    AppComponent,////////////////////removed///////////////////////
  ],imports: [
    ...MaterialModules,////////////added here
    BrowserModule,
原文链接:https://www.f2er.com/angularjs/140327.html

猜你在找的Angularjs相关文章