mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-29 20:40:29 +00:00
fix(ngValue): made ngValue to write value attribute to element
This commit is contained in:
parent
61fb5863df
commit
3b898664ee
2 changed files with 13 additions and 1 deletions
|
|
@ -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);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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">' +
|
||||
|
|
|
|||
Loading…
Reference in a new issue