fixed issue with radio view clobering model if radio was checked.

This commit is contained in:
Misko Hevery
2010-05-13 13:57:39 -07:00
parent 0a288d1db3
commit 22d1464d7a
4 changed files with 176 additions and 129 deletions

View File

@@ -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) {

View File

@@ -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) {