gpt4 book ai didi

angular - 模块 'MatSpinner' 导入了意外指令 'AppModule'。请添加@NgModule 注解

转载 作者:太空狗 更新时间:2023-10-29 16:51:26 26 4
gpt4 key购买 nike

Angular 5 -

这里是 npm 模块 (package.json)-

   "@angular/animations": "^5.0.0",
"@angular/cdk": "^5.0.0-rc.2",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^5.0.0-rc.2",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"

我正在使用 Angular Material Spinner 作为 Material 模块中的 MatSpinner 指令

import { MatSpinner } from "@angular/material";
@NgModule({
imports: [

MatSpinner
],
declarations: [],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }

这是 HTML:

<mat-spinner></mat-spinner>

我遇到错误-

模块“AppModule”导入了意外指令“MatSpinner”。请添加@NgModule 注解。

最佳答案

在您的应用程序模块中,您通常会导入 MatProgressSpinnerModule,而不是 MatSpinner。 MatSpinner 将导入到您的组件中。

关于angular - 模块 'MatSpinner' 导入了意外指令 'AppModule'。请添加@NgModule 注解,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47658948/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com