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

Commit 3b89866

Browse files
kirsteinIgorMinar
authored andcommitted
fix(ngValue): made ngValue to write value attribute to element
1 parent 61fb586 commit 3b89866

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
@@ -1298,7 +1298,7 @@ var ngValueDirective = function() {
12981298
} else {
12991299
return function(scope, elm, attr) {
13001300
scope.$watch(attr.ngValue, function valueWatchAction(value) {
1301-
attr.$set('value', value, false);
1301+
attr.$set('value', value);
13021302
});
13031303
};
13041304
}

test/ng/directive/inputSpec.js

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

11051105
describe('ngValue', function() {
11061106

1107+
it('should update the dom "value" property and attribute', function() {
1108+
compileInput('<input type="submit" ng-value="value">');
1109+
1110+
scope.$apply(function() {
1111+
scope.value = 'something';
1112+
});
1113+
1114+
expect(inputElm[0].value).toBe('something');
1115+
expect(inputElm[0].getAttribute('value')).toBe('something');
1116+
});
1117+
1118+
11071119
it('should evaluate and set constant expressions', function() {
11081120
compileInput('<input type="radio" ng-model="selected" ng-value="true">' +
11091121
'<input type="radio" ng-model="selected" ng-value="false">' +

0 commit comments

Comments
 (0)