angular - 由模块 'BrowserAnimationsModule' 声明的意外模块 'AppModule' 。请添加@Pipe/@Directive/@Component 注解

标签 angular angular-material angular-material-6

这是我的 app.module 我尝试在 material.angular.io 中完成整个指令

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { BrandComponent } from './brand/brand.component';
import { AlertModule } from 'ngx-bootstrap';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatButtonModule, MatCheckboxModule} from '@angular/material';
import 'hammerjs';



@NgModule({
  declarations: [
    AppComponent,
    BrandComponent,
    BrowserAnimationsModule,
    MatButtonModule,
    MatCheckboxModule
  ],
  imports: [
    BrowserModule,
    AlertModule.forRoot(),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

我应该怎么处理这个错误

最佳答案

将您的模块移动到您的导入数组,声明用于声明您的组件

    imports: [
    BrowserAnimationsModule,
    MatButtonModule,
    MatCheckboxModule
    BrowserModule,
    AlertModule.forRoot(),
  ],

关于angular - 由模块 'BrowserAnimationsModule' 声明的意外模块 'AppModule' 。请添加@Pipe/@Directive/@Component 注解,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56045070/

相关文章:

angular - 不能将实体类与 NgModule Angular 2 一起使用

typescript - mat-tab-nav-bar 标签没有显示

angular-material - matAutocomplete control.registerOnChange 不是函数

Angular Material 步进器在每次点击时动态添加新的步骤项目

angular - 单击确认按钮关闭 swal

angular - 从 Ionic 2 更新到 Ionic 3,现在由于 "Unexpected token {"错误而无法构建

javascript - 相同的函数通过设计模式在javascript中返回对象、数组或函数方面的多个值?

Angular Material : mat-drawer-container not showing backdrop with multiple mat-drawer

Angular Material 表自定义过滤器添加和删除多个术语

angular - 如何将静态内容添加到我的水平 Angular 垫表中?