diff options
| author | Mikk Kirstein | 2013-05-14 20:14:06 +0300 |
|---|---|---|
| committer | Igor Minar | 2013-07-11 14:59:38 -0700 |
| commit | 3b898664eea9913b6b25261d7310a61de476d173 (patch) | |
| tree | 17eeaba52273c2210719830f3685ab520ec27a38 | |
| parent | 61fb5863df4afe0fad688a44ff78b245b8439db2 (diff) | |
| download | angular.js-3b898664eea9913b6b25261d7310a61de476d173.tar.bz2 | |
fix(ngValue): made ngValue to write value attribute to element
| -rw-r--r-- | src/ng/directive/input.js | 2 | ||||
| -rw-r--r-- | test/ng/directive/inputSpec.js | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 376d5b7d..246c827e 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -1298,7 +1298,7 @@ var ngValueDirective = function() { } else { return function(scope, elm, attr) { scope.$watch(attr.ngValue, function valueWatchAction(value) { - attr.$set('value', value, false); + attr.$set('value', value); }); }; } diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js index ff504872..d800bf92 100644 --- a/test/ng/directive/inputSpec.js +++ b/test/ng/directive/inputSpec.js @@ -1104,6 +1104,18 @@ describe('input', function() { describe('ngValue', function() { + it('should update the dom "value" property and attribute', function() { + compileInput('<input type="submit" ng-value="value">'); + + scope.$apply(function() { + scope.value = 'something'; + }); + + expect(inputElm[0].value).toBe('something'); + expect(inputElm[0].getAttribute('value')).toBe('something'); + }); + + it('should evaluate and set constant expressions', function() { compileInput('<input type="radio" ng-model="selected" ng-value="true">' + '<input type="radio" ng-model="selected" ng-value="false">' + |
