diff options
| author | Igor Minar | 2013-08-22 10:22:17 -0700 |
|---|---|---|
| committer | Igor Minar | 2013-08-22 10:22:17 -0700 |
| commit | dbcc44dc80644e4390523ab33204b460f60648ec (patch) | |
| tree | 7a74ed4e80b5c360ff6ee282a2d05da1ba187f9b | |
| parent | db87fd52cafa28c13ae0642b91f9a30f0301f257 (diff) | |
| download | angular.js-dbcc44dc80644e4390523ab33204b460f60648ec.tar.bz2 | |
revert: feat(ngForm): Supports expression in form names
This reverts commit 4407e81c618d42c70e8cfca4f52dfc4a669b5c68.
No features or breaking changes in the stable branch please.
| -rw-r--r-- | src/ng/directive/form.js | 4 | ||||
| -rw-r--r-- | test/ng/directive/formSpec.js | 29 |
2 files changed, 4 insertions, 29 deletions
diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js index ec91f4b8..72f752be 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) { - setter(scope, alias, controller, alias); + scope[alias] = controller; } if (parentFormCtrl) { formElement.bind('$destroy', function() { parentFormCtrl.$removeControl(controller); if (alias) { - setter(scope, alias, undefined, alias); + scope[alias] = undefined; } extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards }); diff --git a/test/ng/directive/formSpec.js b/test/ng/directive/formSpec.js index b5bbe535..f8e4cf63 100644 --- a/test/ng/directive/formSpec.js +++ b/test/ng/directive/formSpec.js @@ -83,11 +83,10 @@ describe('form', function() { }); - it('should support expression in form name', function() { + it('should allow form name to be an expression', function() { doc = $compile('<form name="obj.myForm"></form>')(scope); - expect(scope.obj).toBeDefined(); - expect(scope.obj.myForm).toBeTruthy(); + expect(scope['obj.myForm']).toBeTruthy(); }); @@ -326,30 +325,6 @@ describe('form', function() { }); - it('should deregister a child form whose name is an expression when its DOM is removed', function() { - doc = jqLite( - '<form name="parent">' + - '<div class="ng-form" name="child.form">' + - '<input ng:model="modelA" name="inputA" required>' + - '</div>' + - '</form>'); - $compile(doc)(scope); - scope.$apply(); - - var parent = scope.parent, - child = scope.child.form; - - expect(parent).toBeDefined(); - expect(child).toBeDefined(); - expect(parent.$error.required).toEqual([child]); - doc.children().remove(); //remove child - - expect(parent.child).toBeUndefined(); - expect(scope.child.form).toBeUndefined(); - expect(parent.$error.required).toBe(false); - }); - - it('should deregister a input when its removed from DOM', function() { doc = jqLite( '<form name="parent">' + |
