question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mat-icon with svg does not work in MatDialog

See original GitHub issue

Bug, feature request, or proposal:

I switched to svg icons and now any mat-icons I have on dialogs do not read the svg from the registry.

What is the expected behavior?

svg icon should display in a dialog

What is the current behavior?

svg icon does not appear in dialog.

What are the steps to reproduce?

I created a repo here. https://github.com/crowmagnumb/svg-icon. Simply clone it, run …

git clone git@github.com:crowmagnumb/svg-icon.git
cd svg-icon
yarn install
gulp pug
ng serve

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Is there anything else we should know?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
crowmagnumbcommented, Apr 4, 2018

Um, the least you could have done is tell me what you did to make it work which was to change the app component decorator from this

@Component({
  selector: 'material-app',
  templateUrl: 'app.component.html',
  viewProviders: [MatIconRegistry]
})

to

@Component({
  selector: 'material-app',
  templateUrl: 'app.component.html'
})

removing the viewProviders: [MatIconRegistry] direction. All examples and documentation says to do this. If you add it back in you will see that the icon does not appear on the dialog.

So is it no longer required/suggested to set this as a viewProvider?

0reactions
angular-automatic-lock-bot[bot]commented, Sep 8, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mat Dialog Svg Icon Issue - StackBlitz
Issue template for @angular/material.
Read more >
Mat Table is not appearing on MatDialog in Angular 13?
I wanna to display the Mat Table inside the Mat Dialog Box. My requirement is display the list of notifications in the pop...
Read more >
How to: Use Angular Material's Mat-Icon with local SVG Images?
This component works with web fonts like Font-Awesome for instance, simply by adding the name of the image required and an image is...
Read more >
How to use mat-icon in angular? - GeeksforGeeks
It is better to use mat-icon as they serve SVG icons i.e. vector-based icons which are adaptable to any resolution and dimension, ...
Read more >
how to prevent mat dialog close on click outside - You.com
dialog.open(DialogComponent, { disableClose: true }); /* Subscribe to events emitted when the backdrop is clicked NOTE: Since we won't actually be using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found