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

Commit 09a1e7a

Browse files
kirsteinIgorMinar
authored andcommitted
fix(ngValue): made ngValue to write value attribute to element
1 parent 52d6a59 commit 09a1e7a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/ng/directive/input.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ var ngValueDirective = function() {
13351335
} else {
13361336
return function(scope, elm, attr) {
13371337
scope.$watch(attr.ngValue, function valueWatchAction(value) {
1338-
attr.$set('value', value, false);
1338+
attr.$set('value', value);
13391339
});
13401340
};
13411341
}

test/ng/directive/inputSpec.js

+12
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,18 @@ describe('input', function() {
11361136

11371137
describe('ngValue', function() {
11381138

1139+
it('should update the dom "value" property and attribute', function() {
1140+
compileInput('<input type="submit" ng-value="value">');
1141+
1142+
scope.$apply(function() {
1143+
scope.value = 'something';
1144+
});
1145+
1146+
expect(inputElm[0].value).toBe('something');
1147+
expect(inputElm[0].getAttribute('value')).toBe('something');
1148+
});
1149+
1150+
11391151
it('should evaluate and set constant expressions', function() {
11401152
compileInput('<input type="radio" ng-model="selected" ng-value="true">' +
11411153
'<input type="radio" ng-model="selected" ng-value="false">' +

0 commit comments

Comments
 (0)