angularangular-materialangular-material-15

NullInjectorError: No provider for MatSelect! After upgrade to angular material 15


I have updated angular project from v14 to v15.0.4 and mat-select throws the error. It was fully working before upgrading.

Angular version : 15.0.4 Angular Material version : 15.0.4

ERROR NullInjectorError: R3InjectorError(TestModule)[MatSelect -> MatSelect -> MatSelect]: NullInjectorError: No provider for MatSelect!

Current still using the legacy-select, imported in material.module.ts and it's imported in app module

import {MatLegacySelectModule as MatSelectModule} from '@angular/material/legacy-select';

imports: [
        MatSelectModule,
    ],

Solution

  • If you still use MatLegacySelectModule and use ngx-mat-select-search dependency, make sure you are in version 6.x.x. (Cf Compatibility part)