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

MdIcon: SVG icon is not removed when svgIcon input is set to undefined #6495

Closed
benelliott opened this issue Aug 16, 2017 · 1 comment · Fixed by #6502
Closed

MdIcon: SVG icon is not removed when svgIcon input is set to undefined #6495

benelliott opened this issue Aug 16, 2017 · 1 comment · Fixed by #6502
Assignees

Comments

@benelliott
Copy link
Contributor

benelliott commented Aug 16, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When you render an SVG icon using MdIcon's svgIcon input then clear the input, the SVG element should be removed from the DOM.

What is the current behavior?

The SVG element stays in the DOM.

What are the steps to reproduce?

  1. Create an md-icon with svgIcon
  2. Set svgIcon to undefined
  3. See that the icon is not cleared

Providing a Plunker (or similar) is the best way to get the team to see your issue.
See: http://plnkr.co/edit/Rd7LEU0nDBYoogHyfZQV?p=preview

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

Cannot reuse an MdIcon instance for configurations that do or do not use svgIcon.

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

Material 2.0.0-beta.8, Angular 4.3.3, TypeScript 2.4.2

Is there anything else we should know?

As a temporary workaround you can use two MdIcon instances, but predicate them on whether the icon source is an SVG and swap them out when necessary.

@benelliott benelliott changed the title MdIcon: SVG icon is not unset when svgIcon input is set to undefined MdIcon: SVG icon is not removed when svgIcon input is set to undefined Aug 16, 2017
@crisbeto crisbeto self-assigned this Aug 16, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 16, 2017
Fixes the underlying SVG element not being removed when the `svgIcon` binding is set to undefined.

Fixes angular#6495.
@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants