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

查看:93
本文介绍了错误:@ 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然后(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.要在整个应用中更新前缀,请遵循此 前缀更新程序中的准则 .

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的CHANGELOG :

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类 早在二月).下一个Beta中将删除"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.

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

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

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

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