aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMisko Hevery2010-05-13 13:57:39 -0700
committerMisko Hevery2010-05-13 13:57:39 -0700
commit22d1464d7abc284dd56d6beaf47e8d85088e01c5 (patch)
tree41c2702dc7505c30aa87edc87f17b8a50a77aaa8 /src
parent0a288d1db368ae0754482ad06fe2a78ce6a9de85 (diff)
downloadangular.js-22d1464d7abc284dd56d6beaf47e8d85088e01c5.tar.bz2
fixed issue with radio view clobering model if radio was checked.
Diffstat (limited to 'src')
-rw-r--r--src/Scope.js2
-rw-r--r--src/widgets.js10
2 files changed, 9 insertions, 3 deletions
diff --git a/src/Scope.js b/src/Scope.js
index 687d3628..7bcf7380 100644
--- a/src/Scope.js
+++ b/src/Scope.js
@@ -97,7 +97,7 @@ function createScope(parent, services, existing) {
$set: bind(instance, setter, instance),
$eval: function $eval(exp) {
- if (exp) {
+ if (exp !== undefined) {
return expressionCompile(exp).apply(instance, slice.call(arguments, 1, arguments.length));
} else {
foreach(evalLists.sorted, function(list) {
diff --git a/src/widgets.js b/src/widgets.js
index 4eae735f..7de4bdc1 100644
--- a/src/widgets.js
+++ b/src/widgets.js
@@ -155,9 +155,15 @@ function initWidgetValue(initValue) {
function radioInit(model, view, element) {
var modelValue = model.get(), viewValue = view.get(), input = element[0];
+ input.checked = false;
input.name = this.$id + '@' + input.name;
- if (isUndefined(modelValue)) model.set(null);
- if (viewValue !== null) model.set(viewValue);
+ if (isUndefined(modelValue)) {
+ model.set(modelValue = null);
+ }
+ if (modelValue == null && viewValue !== null) {
+ model.set(viewValue);
+ }
+ view.set(modelValue);
}
function inputWidget(events, modelAccessor, viewAccessor, initFn) {