You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Current behavior: directive ngValue sometimes do not update value attribute. In my examples below, I clear $rootScope.someText value with delete operator (or set $rootScope.someText to undefined) and ngValue directive do not update view value.
Theoretically, when the value changes to undefined (either via delete $rootScope.someText or $rootScope.someText = undefined), the value attribute should be removed and the value property should be set to undefined (which essentially sets it to '' for <input> elements.
The problem is that element.prop('value', undefined) does not work as expected, because jqLite treats it in the same way as element.prop('value') (the getter). For example, $rootScope.someText = null works as expected.
jQuery handles it in th same way (.prop('value', undefined) is the same as .prop('value')). It seems we need special logic inside ngValue to convert undefined values to null (or something).
…ndefined
Previously, when the expression evaluated to `undefined` the `value` property
was not updated. This happened because jqLite/jQuery's `prop(_, undefined)` is
treated as a getter, thus not apdating the property.
This commit fixes it by setting the property to `null` instead.
(On IE9 we use `''` - see inline comments for more info.)
Fixes#15603Closes#15605
ellimist
pushed a commit
to ellimist/angular.js
that referenced
this issue
Mar 15, 2017
…ndefined
Previously, when the expression evaluated to `undefined` the `value` property
was not updated. This happened because jqLite/jQuery's `prop(_, undefined)` is
treated as a getter, thus not apdating the property.
This commit fixes it by setting the property to `null` instead.
(On IE9 we use `''` - see inline comments for more info.)
Fixesangular#15603Closesangular#15605
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It is a bug.
Current behavior: directive ngValue sometimes do not update value attribute. In my examples below, I clear $rootScope.someText value with delete operator (or set $rootScope.someText to undefined) and ngValue directive do not update view value.
Demo:
Example in CodePen: https://codepen.io/dmitry_krekota/pen/NdNYjr
Screen record with bug reproduce steps (12 seconds): https://drive.google.com/file/d/0Bxtv10NlSOEbeXJWWnhZc1A0anM/view
Also, you can download the html file with demo: https://cl.ly/1h0F3l2P032K/download/demo.html
Expected behavior: ngValue must set attribute value to '', when when there is no value in $rootScope.someText variable.
Environment: Windows 7, Chrome 56
Angular version: 1.6.1
The text was updated successfully, but these errors were encountered: