From 4407e81c618d42c70e8cfca4f52dfc4a669b5c68 Mon Sep 17 00:00:00 2001 From: Matthew Windwer Date: Tue, 2 Jul 2013 15:14:24 -0400 Subject: feat(ngForm): Supports expression in form names
form controller will accessible as $scope.ctrl.form instead of $scope['ctrl.form'] BREAKING CHANGE: If you have form names that will evaluate as an expression: And if you are accessing the form from your controller: Before: function($scope) { $scope['ctrl.form'] // form controller instance } After: function($scope) { $scope.ctrl.form // form controller instance } This makes it possible to access a form from a controller using the new "controller as" syntax. Supporting the previous behavior offers no benefit. --- src/ng/directive/form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ng/directive/form.js') diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js index 72f752be..ec91f4b8 100644 --- a/src/ng/directive/form.js +++ b/src/ng/directive/form.js @@ -306,13 +306,13 @@ var formDirectiveFactory = function(isNgForm) { alias = attr.name || attr.ngForm; if (alias) { - scope[alias] = controller; + setter(scope, alias, controller, alias); } if (parentFormCtrl) { formElement.bind('$destroy', function() { parentFormCtrl.$removeControl(controller); if (alias) { - scope[alias] = undefined; + setter(scope, alias, undefined, alias); } extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards }); -- cgit v1.2.3