Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Force a model value to be changed via ngKeypress doesn't reflect the ngValue on itself #16006

Closed
1 of 3 tasks
betonetotbo opened this issue May 22, 2017 · 1 comment
Closed
1 of 3 tasks

Comments

@betonetotbo
Copy link

I'm submitting a ...

  • bug report
  • feature request
  • other (Please do not submit support requests here (see above))

Current behavior:
Force a model value to be changed via ngKeypress doesn't reflect the ngValue on itself.

Expected / new behavior:
After change the value, the ngValue must be evaluated and the input value must be updated.
Using angular 1.6.x this doesn't occurs.

Minimal reproduction of the problem with instructions:
https://codepen.io/betonetotbo/pen/LyMNpK

Angular version: 1.5.8

Browser: [Chrome 58]

@gkalpak
Copy link
Member

gkalpak commented May 22, 2017

This is expected behavior and is related tot he fact that in v1.5.x, ngValue only modifies the value attribute, not the value property. This has changed in v1.6.x, so that ngValue updates both the attribute and the property, thus reflecting expression changes to the input's value.

The reason it does initially work in v1.5.x (where only the value attribute is updated), is because of how the spec defines the behavior in case the input is not dirty:

The value content attribute gives the default value of the input element. When the value content attribute is added, set, or removed, if the control's dirty value flag is false, the user agent must set the value of the element to the value of the value content attribute, if there is one, or the empty string otherwise [...].

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants