Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task
graknow opened this issue Aug 15, 2024 · 1 comment · Fixed by #29589
Closed
1 task
Assignees
Labels
area: material/icon P4 A relatively minor issue that is not relevant to core functions

Comments

@graknow
Copy link

graknow commented Aug 15, 2024

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
@graknow graknow added the needs triage This issue needs to be triaged by the team label Aug 15, 2024
@crisbeto crisbeto self-assigned this Aug 15, 2024
@crisbeto crisbeto added P4 A relatively minor issue that is not relevant to core functions area: material/icon and removed needs triage This issue needs to be triaged by the team labels Aug 15, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 15, 2024
Updates the message saying that `HttpClient` is missing to refer to a non-deprecated API.

Fixes angular#29587.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 15, 2024
Updates the message saying that `HttpClient` is missing to refer to a non-deprecated API.

Fixes angular#29587.
crisbeto added a commit that referenced this issue Aug 15, 2024
Updates the message saying that `HttpClient` is missing to refer to a non-deprecated API.

Fixes #29587.

(cherry picked from commit 4f2bc4d)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/icon P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants