diff options
| author | Vojta Jina | 2012-03-23 13:04:52 -0700 |
|---|---|---|
| committer | Vojta Jina | 2012-03-26 21:14:09 -0700 |
| commit | 09e175f02cca0f4a295fd0c9b980cd8f432e722b (patch) | |
| tree | 49796ba88d2db7a6e621155e9849109206f744cd /src/service/compiler.js | |
| parent | 5c5b1183c82a28841b3e1e246ee341262e91d743 (diff) | |
| download | angular.js-09e175f02cca0f4a295fd0c9b980cd8f432e722b.tar.bz2 | |
feat(ngValue): allow radio inputs to have non string values
Closes #816
Diffstat (limited to 'src/service/compiler.js')
| -rw-r--r-- | src/service/compiler.js | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/service/compiler.js b/src/service/compiler.js index 9e03f186..8ddf77ae 100644 --- a/src/service/compiler.js +++ b/src/service/compiler.js @@ -732,7 +732,7 @@ function $CompileProvider($provide) { if (src[key]) { value += (key === 'style' ? ';' : ' ') + src[key]; } - dst.$set(key, value, srcAttr[key]); + dst.$set(key, value, true, srcAttr[key]); } }); // copy the new attributes on the old attrs object @@ -937,9 +937,11 @@ function $CompileProvider($provide) { * can share the attribute. This function properly handles boolean attributes. * @param {string} key Normalized key. (ie ngAttribute) * @param {string|boolean} value The value to set. If `null` attribute will be deleted. + * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute. + * Defaults to true. * @param {string=} attrName Optional none normalized name. Defaults to key. */ - function attrSetter(key, value, attrName) { + function attrSetter(key, value, writeAttr, attrName) { var booleanKey = isBooleanAttr(this.$element[0], key.toLowerCase()); if (booleanKey) { @@ -962,12 +964,15 @@ function $CompileProvider($provide) { } } - if (value === null || value === undefined) { - this.$element.removeAttr(attrName); - } else { - this.$element.attr(attrName, value); + if (writeAttr !== false) { + if (value === null || value === undefined) { + this.$element.removeAttr(attrName); + } else { + this.$element.attr(attrName, value); + } } + // fire observers forEach(this.$observers[key], function(fn) { try { |
