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

Ng style doesnt remove old style when the model object changes #15457

Closed
lakshaydulani opened this issue Mar 24, 2017 · 5 comments · Fixed by #15539
Closed

Ng style doesnt remove old style when the model object changes #15457

lakshaydulani opened this issue Mar 24, 2017 · 5 comments · Fixed by #15539
Labels
area: core Issues related to the framework runtime type: bug/fix

Comments

@lakshaydulani
Copy link

Current behaviour - If you assign an object to ngStyle in a div, ngStyle doesnt flush the style properties from the older object when it changes.

Expected/desired behavior - All the old object style should be flushed, and only the new object style properties should be applied.

Reproduction of the problem
http://plnkr.co/edit/ccS4gOZgdMqguwIcGRob?p=preview

In the above plunkr, click on first button (margin border background), then on second and then on third. Till this, it works fine.
But now click on second button (border background), margin property should be removed but it isn't.

I had earlier reported the same issue - #10315

@DzmitryShylovich
Copy link
Contributor

DzmitryShylovich commented Mar 24, 2017

it will work if you change prop order

 three(){
    this.style = {"margin":"10px", "border":"1px solid black" };
  }

http://plnkr.co/edit/YzXr7RG8l0U9BbJ94e7w?p=preview

@sod
Copy link
Contributor

sod commented Mar 24, 2017

image

@DzmitryShylovich
Copy link
Contributor

DzmitryShylovich commented Mar 24, 2017

Yeah, it's a KeyValueDiffer bug

@IgorMinar IgorMinar added area: core Issues related to the framework runtime type: bug/fix labels Mar 24, 2017
@vicb
Copy link
Contributor

vicb commented Mar 24, 2017

Can reproduce @lakshaydulani please complete the full template next time you report an issue, thanks

vicb added a commit to vicb/angular that referenced this issue Mar 27, 2017
vicb added a commit to vicb/angular that referenced this issue Mar 28, 2017
vicb added a commit to vicb/angular that referenced this issue Mar 28, 2017
vicb added a commit to vicb/angular that referenced this issue Mar 28, 2017
vicb added a commit that referenced this issue Mar 28, 2017
vicb added a commit that referenced this issue Mar 29, 2017
asnowwolf pushed a commit to asnowwolf/angular that referenced this issue Aug 11, 2017
juleskremer pushed a commit to juleskremer/angular that referenced this issue Aug 28, 2017
@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 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants