错误:@angular/material/material 没有导出成员“MdButtonModule" [英] ERROR: @angular/material/material has no exported member 'MdButtonModule'

查看:23
本文介绍了错误:@angular/material/material 没有导出成员“MdButtonModule"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从@angular/material 2.0.0-beta.11 升级到 2.0.0-beta.12 后出现以下错误:

Error below arose after upgrading from @angular/material 2.0.0-beta.11 to 2.0.0-beta.12:

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

Module @angular/material/material has no exported member 'MdButtonModule'.

打字稿代码:

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

发生了什么?

错误在 c:/dev/my-proj/src/app/app-material/app-material.module.ts(4,3):模块'"c:/dev/my-proj/node_modules/@angular/material/material"' 没有导出成员MdButtonModule".错误在c:/dev/my-proj/src/app/app-material/app-material.module.ts (5,3):模块 '"c:/dev/my-proj/node_modules/@angular/material/material"' 有没有导出成员MdCardModule".错误在c:/dev/my-proj/src/app/app-material/app-material.module.ts (6,3):模块 '"c:/dev/my-proj/node_modules/@angular/material/material"' 有没有导出成员MdCheckboxModule".错误在c:/dev/my-proj/src/app/app-material/app-material.module.ts (7,3):模块 '"c:/dev/my-proj/node_modules/@angular/material/material"' 有没有导出成员MdIconModule".错误在c:/dev/my-proj/src/app/app-material/app-material.module.ts (8,3):模块 '"c:/dev/my-proj/node_modules/@angular/material/material"' 有没有导出成员MdOptionModule".错误在c:/dev/my-proj/src/app/app-material/app-material.module.ts (9,3):模块 '"c:/dev/my-proj/node_modules/@angular/material/material"' 有没有导出成员MdProgressSpinnerModule".错误在c:/dev/my-proj/src/app/app-material/app-material.module.ts (10,3):模块 '"c:/dev/my-proj/node_modules/@angular/material/material"' 有没有导出成员MdSelectModule".错误在c:/dev/my-proj/src/app/app-material/app-material.module.ts (11,3):模块 '"c:/dev/my-proj/node_modules/@angular/material/material"' 有没有导出成员MdSidenavModule".错误在c:/dev/my-proj/src/app/app-material/app-material.module.ts (12,3):模块 '"c:/dev/my-proj/node_modules/@angular/material/material"' 有没有导出成员MdToolbarModule".错误中的错误:MdButtonModule不是 NgModule在 _getNgModuleMetadata (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:140:15)在 _extractLazyRoutesFromStaticModule (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:109:26)在 c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:129:27在 Array.reduce(本机)在 _extractLazyRoutesFromStaticModule (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:128:10)在 c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:129:27在 Array.reduce(本机)在 _extractLazyRoutesFromStaticModule (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:128:10)在 Object.listLazyRoutesOfModule (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:53:22)在 Function.NgTools_InternalApi_NG_2.listLazyRoutes (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_api.js:91:39)在 AotPlugin._getLazyRoutesFromNgtools (c:\dev\my-proj\node_modules\@ngtools\webpack\src\plugin.js:207:44)在 _donePromise.Promise.resolve.then.then.then.then.then (c:\dev\my-proj\node_modules\@ngtools\webpack\src\plugin.js:443:24)

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:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:140:15) at _extractLazyRoutesFromStaticModule (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:109:26) at c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:129:27 at Array.reduce (native) at _extractLazyRoutesFromStaticModule (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:128:10) at c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:129:27 at Array.reduce (native) at _extractLazyRoutesFromStaticModule (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:128:10) at Object.listLazyRoutesOfModule (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_impl.js:53:22) at Function.NgTools_InternalApi_NG_2.listLazyRoutes (c:\dev\my-proj\node_modules\@angular\compiler-cli\src\ngtools_api.js:91:39) at AotPlugin._getLazyRoutesFromNgtools (c:\dev\my-proj\node_modules\@ngtools\webpack\src\plugin.js:207:44) at _donePromise.Promise.resolve.then.then.then.then.then (c:\dev\my-proj\node_modules\@ngtools\webpack\src\plugin.js:443:24)

推荐答案

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

You have to include MatButtonModule instead of MdButtonModule. You will also have to update the prefix in your template i.e. md-button should now be mat-button. To update the prefix in your entire app, follow the guidelines in this Prefix Updater.

2.0.0-beta.12 起,Md 前缀已被删除,您应该在任何地方使用 Mat 前缀.来自 2.0.0-beta.11 的变更日志:

Since 2.0.0-beta.12 the Md prefix has been removed and you should use Mat prefix everywhere. From the CHANGELOG of 2.0.0-beta.11:

对于 beta.11,我们决定弃用md"前缀完全并使用垫子"前进.这会影响所有类名,属性、输入、输出和选择器(CSS 类已更改二月份回来).md"前缀将在下一个测试版中删除发布.

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:

And from the CHANGELOG of 2.0.0-beta.12:

重大变化删除了所有md"前缀.

Breaking Changes All "md" prefixes have been removed.

看到这个工作 StackBlitz 演示 带有单独的材料模块并使用 Mat 前缀.

See this working StackBlitz demo with individual material modules and using Mat prefix.

这篇关于错误:@angular/material/material 没有导出成员“MdButtonModule"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆