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

ngClass with breakpoints doesn't remove class once added. #992

Closed
mhosman opened this issue Jan 14, 2019 · 3 comments · Fixed by #995
Closed

ngClass with breakpoints doesn't remove class once added. #992

mhosman opened this issue Jan 14, 2019 · 3 comments · Fixed by #995
Assignees
Labels
bug has pr A PR has been created to address this issue P1 Urgent issue that should be resolved before the next re-lease
Milestone

Comments

@mhosman
Copy link

mhosman commented Jan 14, 2019

Bug Report

What is the expected behavior?

When ngClass is used with breakpoint then it should add specified class for that breakpoint and remove once breakpoint changes

for below example
[ngClass.lt-md] = "'test'"

What is the current behavior?

ngClass is not removing class when screen size changes.

What are the steps to reproduce?

Try to resize the screen and observe behavior.

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

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

Angular 7+
flex-layout 7.0.0-beta23

Is there anything else we should know?

It was working fine till 7.0.0-beta.19

@CaerusKaru
Copy link
Member

Workaround in the meantime is to add ngClass="" to any element without it.

@CaerusKaru CaerusKaru self-assigned this Jan 14, 2019
@CaerusKaru CaerusKaru added bug in-progress P1 Urgent issue that should be resolved before the next re-lease labels Jan 14, 2019
@CaerusKaru CaerusKaru added this to the 7.0.0-beta.24 milestone Jan 14, 2019
@CaerusKaru
Copy link
Member

This will be fixed by #995. Thanks for catching this!

@CaerusKaru CaerusKaru added has pr A PR has been created to address this issue and removed in-progress labels Jan 15, 2019
ThomasBurleson pushed a commit that referenced this issue Jan 15, 2019
In some cases where a fallback `ngClass` is not defined, the ClassDirective had no way of knowing to remove its ngClass on deactivation. 

> Unlike other directives, the `removeStyles` action has no effect on ClassDirective.

By specifying an empty default fallback, we ensure that on deactivation - if no other default is specified - the ClassDirective will correctly fallback to an empty string case.


Fixes #992.
@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 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug has pr A PR has been created to address this issue P1 Urgent issue that should be resolved before the next re-lease
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants