简体   繁体   中英

Angular: Mat-Progress-Spinner does not recognize indeterminate mode when updating from Angular 9/10 to 13

I am updating my Angular app from 9/10 to 13 and I've been following the official documentation here . I rewrote my old code accordingly to fit the new convention:

<mat-progress-spinner
    [color]="primary"
    [mode]="indeterminate">
  </mat-progress-spinner>

But apparently this does not compile... The error I get is:

error TS2339: Property 'indeterminate' does not exist on type 'ComponentNameHere'.

Yes, I've imported the Mat-Progress-Spinner already in module.ts

UPDATE

If I remove the brackets from color and mode I get the following error:

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.

UPDATE 2

My module.ts looks like the following:

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,
        ...

Figured it out, I needed to remove the [] brackets from the bindings and it seems that some removed packages (due to no longer being maintained for newer versions of Angular) caused the issue. Commented out their imports and the app seems to magically work.

I removed (by commenting out) the ng-docx , angular-bootstrap-md and ng-mat-search-bar packages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM