加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

错误:@ angular / material / material没有导出成员’MdButtonM

发布时间:2020-12-17 07:50:18 所属栏目:安全 来源:网络整理
导读:从@ angular / material 2.0.0-beta.11升级到2.0.0-beta.12后出现以下错误: 模块@ angular / material / material没有导出成员’MdButtonModule’. 打字稿代码: import { MdButtonModule } from '@angular/material'; 发生了什么? ERROR in c:/dev/my-pro
从@ angular / material 2.0.0-beta.11升级到2.0.0-beta.12后出现以下错误:

模块@ angular / material / material没有导出成员’MdButtonModule’.

打字稿代码:

import { MdButtonModule } from '@angular/material';

发生了什么?

ERROR in c:/dev/my-proj/src/app/app-material/app-material.module.ts
(4,3): Module
‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has no
exported member ‘MdButtonModule’. ERROR in
c:/dev/my-proj/src/app/app-material/app-material.module.ts (5,3):
Module ‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has
no exported member ‘MdCardModule’. ERROR in
c:/dev/my-proj/src/app/app-material/app-material.module.ts (6,3):
Module ‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has
no exported member ‘MdCheckboxModule’. ERROR in
c:/dev/my-proj/src/app/app-material/app-material.module.ts (7,3):
Module ‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has
no exported member ‘MdIconModule’. ERROR in
c:/dev/my-proj/src/app/app-material/app-material.module.ts (8,3):
Module ‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has
no exported member ‘MdOptionModule’. ERROR in
c:/dev/my-proj/src/app/app-material/app-material.module.ts (9,3):
Module ‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has
no exported member ‘MdProgressSpinnerModule’. ERROR in
c:/dev/my-proj/src/app/app-material/app-material.module.ts (10,3):
Module ‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has
no exported member ‘MdSelectModule’. ERROR in
c:/dev/my-proj/src/app/app-material/app-material.module.ts (11,3):
Module ‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has
no exported member ‘MdSidenavModule’. ERROR in
c:/dev/my-proj/src/app/app-material/app-material.module.ts (12,3):
Module ‘”c:/dev/my-proj/node_modules/@angular/material/material”‘ has
no exported member ‘MdToolbarModule’. ERROR in Error: MdButtonModule
is not an NgModule
at _getNgModuleMetadata (c:devmy-projnode_modules@angularcompiler-clisrcngtools_impl.js:140:15)
at _extractLazyRoutesFromStaticModule (c:devmy-projnode_modules@angularcompiler-clisrcngtools_impl.js:109:26)
at c:devmy-projnode_modules@angularcompiler-clisrcngtools_impl.js:129:27
at Array.reduce (native)
at _extractLazyRoutesFromStaticModule (c:devmy-projnode_modules@angularcompiler-clisrcngtools_impl.js:128:10)
at c:devmy-projnode_modules@angularcompiler-clisrcngtools_impl.js:129:27
at Array.reduce (native)
at _extractLazyRoutesFromStaticModule (c:devmy-projnode_modules@angularcompiler-clisrcngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (c:devmy-projnode_modules@angularcompiler-clisrcngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (c:devmy-projnode_modules@angularcompiler-clisrcngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (c:devmy-projnode_modules@ngtoolswebpacksrcplugin.js:207:44)
at _donePromise.Promise.resolve.then.then.then.then.then (c:devmy-projnode_modules@ngtoolswebpacksrcplugin.js:443:24)

您必须包含MatButtonModule而不是MdButtonModule.您还必须更新模板中的前缀,即md-button现在应该是mat-button.要更新整个应用中的前缀,请遵循此 Prefix Updater中的准则.

从2.0.0-beta.12开始,Md前缀已被删除,您应该在任何地方都使用Mat前缀.从2.0.0-beta.11的CHANGELOG开始:

For beta.11,we’ve made the decision to deprecate the “md” prefix
completely and use “mat” moving forward. This affects all class names,
properties,inputs,outputs,and selectors (CSS classes were changed
back in February). The “md” prefixes will be removed in the next beta
release.

从2.0.0-beta.12的CHANGELOG开始:

Breaking Changes
All “md” prefixes have been removed.

使用单个材料模块和使用Mat前缀查看此工作StackBlitz demo.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读