Skip to content

bug(MatIconRegistry): Change error message to not suggest a deprecated component, HttpClientModule. #29587

Closed
@graknow

Description

@graknow

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When trying to load an .svg into the MatIconRegistry without including the provideHttpClient provider, the error message printed to the console will be:

Could not find HttpClient provider for use with Angular Material icons. Please include the HttpClientModule from @angular/common/http in your app imports.

This error message is misleading, as the method for correcting the issue is to use the provider provideHttpClient as described by the depreciated comment on the HttpClientModule.

Reproduction

StackBlitz link: https://stackblitz.com/edit/components-issue-blslak
Steps to reproduce:

  1. Add an icon to the MatIconRegistry inside example-component.ts.
  2. Remove deprecated module HttpClientModule from main.ts.
  3. Observe the error message in the console.

Expected Behavior

The error message refers to provideHttpClient() as the proper solution to the issue.

Actual Behavior

The error message refers to a deprecated feature which is inconsistent with other documentation of the MatIconRegistry.

Environment

  • Angular: 18.1.3
  • CDK/Material: 18.1.4
  • Browser(s): Firefox
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsarea: material/icon

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions