[英]Angular: Mat-Progress-Spinner does not recognize indeterminate mode when updating from Angular 9/10 to 13
我正在将我的 Angular 应用程序从 9/10 更新到 13,并且我一直在关注官方文档。 我相应地重写了旧代码以适应新约定:
<mat-progress-spinner
[color]="primary"
[mode]="indeterminate">
</mat-progress-spinner>
但显然这不能编译......我得到的错误是:
error TS2339: Property 'indeterminate' does not exist on type 'ComponentNameHere'.
是的,我已经在 module.ts 中导入了 Mat-Progress-Spinner
更新
如果我从颜色和模式中删除括号,我会收到以下错误:
error NG8001: 'mat-progress-spinner' is not a known element:
1. If 'mat-progress-spinner' is an Angular component, then verify that it is part of this module.
2. If 'mat-progress-spinner' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
更新 2
我的 module.ts 如下所示:
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
...
imports: [
BrowserModule,
AppRoutingModule,
ReactiveFormsModule,
FormsModule,
MDBBootstrapModule.forRoot(),
Ng2SearchPipeModule,
NgMatSearchBarModule,
BrowserAnimationsModule,
MatInputModule,
WavesModule,
InputsModule,
ButtonsModule,
HttpClientModule,
MatIconModule,
MatTableModule,
MatCheckboxModule,
MatSortModule,
MatTabsModule,
MatSelectModule,
MatCheckboxModule,
MatInputModule,
MatTreeModule,
MatButtonModule,
MatDialogModule,
MatProgressBarModule,
MatDatepickerModule,
MatNativeDateModule,
MatTooltipModule,
MatRadioModule,
MatDividerModule,
ModalModule,
MatPaginatorModule,
// Mat-Slide-Toggle
MatProgressSpinnerModule,
...
想通了,我需要从绑定中删除[]
括号,似乎一些已删除的包(由于不再为较新版本的 Angular 维护)导致了这个问题。 注释掉他们的导入,该应用程序似乎神奇地工作。
我删除(通过注释掉) ng-docx
、 angular-bootstrap-md
和ng-mat-search-bar
包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.