diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Scope.js | 2 | ||||
| -rw-r--r-- | src/Widgets.js | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/Scope.js b/src/Scope.js index 2b2db189..26a3f85b 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -84,6 +84,7 @@ function errorHandlerFor(element, error) { elementError(element, NG_EXCEPTION, isDefined(error) ? toJson(error) : error); } +var scopeId = 0; function createScope(parent, Class) { function Parent(){} function API(){} @@ -103,6 +104,7 @@ function createScope(parent, Class) { extend(api, { 'this': instance, + $id: (scopeId++), $parent: parent, $bind: bind(instance, bind, instance), $get: bind(instance, getter, instance), diff --git a/src/Widgets.js b/src/Widgets.js index e42d981c..a05ea63c 100644 --- a/src/Widgets.js +++ b/src/Widgets.js @@ -111,8 +111,9 @@ function initWidgetValue(initValue) { }; } -function radioInit(model, view) { - var modelValue = model.get(), viewValue = view.get(); +function radioInit(model, view, element) { + var modelValue = model.get(), viewValue = view.get(), input = element[0]; + input.name = this.$id + '@' + input.name; if (isUndefined(modelValue)) model.set(null); if (viewValue != null) model.set(viewValue); } @@ -123,7 +124,7 @@ function inputWidget(events, modelAccessor, viewAccessor, initFn) { model = modelAccessor(scope, element), view = viewAccessor(scope, element), action = element.attr('ng-change') || ''; - initFn(model, view); + initFn.call(scope, model, view, element); this.$eval(element.attr('ng-init')||''); element.bind(events, function(){ model.set(view.get()); |
