首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >角度为7的角度材质

角度为7的角度材质
EN

Stack Overflow用户
提问于 2020-05-05 03:07:53
回答 1查看 50关注 0票数 0

我是angular的新手,但我们正在为弹出功能实现Angular材料。

在app.module.ts中,我使用以下导入语句导入MatButtonModule和MatDialog模块。

代码语言:javascript
复制
import {MatButtonModule} from "@angular/material/button/typings/button-module";
import {MatDialogModule} from "@angular/material/dialog/typings/dialog-module";

由于某些原因,当我使用ng build进行编译时,我得到了下面的错误消息。

代码语言:javascript
复制
ng build

Date: 2020-05-04T18:47:12.434Z
Hash: 9bec1eb21effd8a26717
Time: 10607ms
chunk {main} main.js, main.js.map (main) 426 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 425 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 200 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 5.56 MB [initial] [rendered]

ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '@angular/material/button/typings/button-module' in 
'C:\Code\AFI\bugs\68550\Hpfc.Afi.Web\src\app'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve '@angular/material/dialog/typings/dialog-module' in 
'C:\Code\AFI\bugs\68550\Hpfc.Afi.Web\src\app'

Here are my versions
Angular CLI: 7.3.9
Node: 12.16.2
OS: win32 x64
Angular: 7.2.15
... common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.13.9
@angular-devkit/build-angular   0.13.9
@angular-devkit/build-webpack   0.13.9
@angular-devkit/core            0.7.5
@angular-devkit/schematics      0.7.5
@angular/animations             7.2.16
@angular/cdk                    7.3.7
@angular/cli                    7.3.9
@angular/material               7.3.7
@ngtools/json-schema            1.1.0
@ngtools/webpack                7.3.9
@schematics/angular             7.3.9
@schematics/package-update      0.7.5
@schematics/update              0.13.9
rxjs                            6.5.4
typescript                      3.2.4
webpack                         4.29.0

为了获得这些错误消息,我遗漏了什么或者没有正确地执行?

EN

回答 1

Stack Overflow用户

发布于 2020-07-30 15:07:41

为了导入这些模块,您还需要将它们添加到要使用它们的模块中,例如: app.module.ts

代码语言:javascript
复制
@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, MatButtonModule, MatDialogModule],
  providers: [],
  bootstrap: [AppComponent]
})

然后,您应该能够在属于该模块的所有组件中使用这两个组件

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61599766

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档