簡體   English   中英

Angular:從 Angular 9/10 更新到 13 時,Mat-Progress-Spinner 無法識別不確定模式

[英]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-docxangular-bootstrap-mdng-mat-search-bar包。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM