角材料2配置错误
发布时间:2020-12-17 18:05:48 所属栏目:安全 来源:网络整理
导读:角度材料2使用cli.当我安装@ angular / material并将其包含在app.module中时,编译器会通过3个警告. 我做了什么 npm install –save @ angular / material .....other importsimport { MaterialModule } from '@angular/material';@NgModule({ declarations:
角度材料2使用cli.当我安装@ angular / material并将其包含在app.module中时,编译器会通过3个警告.
我做了什么 npm install –save @ angular / material .....other imports import { MaterialModule } from '@angular/material'; @NgModule({ declarations: [ AppComponent ],imports: [ MaterialModule.forRoot(),other imports... ],providers: [],bootstrap: [AppComponent] }) export class AppModule { } 其他设置 styles.css的 @import’~@angular/material/core/theming/prebuilt/deeppurple-amber.css’; 的index.html ... <script src="https://ajax.googleapis.com/ajax/libs/hammerjs/2.0.8/hammer.min.js"></script> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> ... 警告 1. WARNING in ./~/@angular/material/module.js 64:4 export 'ProjectionModule' was not foun d in './core/index' 2. WARNING in ./~/@angular/material/module.js 89:16 export 'ProjectionModule' was not fou nd in './core/index' 3. WARNING in ./~/@angular/material/dialog/ind ex.js 21:75 export 'Platform' was not found in '. ./core' 运行http://localhost:4200/时出错 Uncaught TypeError: Cannot read property 'prototype' of undefined at __extends (snack-bar-container.js:4) at snack-bar-container.js:28 at Object.<anonymous> (snack-bar-container.js:122) at __webpack_require__ (bootstrap 9ff6af8…:52) at Object.<anonymous> (snack-bar-ref.js:70) at __webpack_require__ (bootstrap 9ff6af8…:52) at Object.<anonymous> (menu.js:40) at __webpack_require__ (bootstrap 9ff6af8…:52) at Object.<anonymous> (icon.js:264) at __webpack_require__ (bootstrap 9ff6af8…:52) 解决方法
从官方
documentation开始,您应该导入每个模块.我在开发过程中一次导入所有内容,但没有.forRoot(),并且工作正常:
imports: [ MaterialModule,], (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |