Skip to content

Commit dbcc44d

Browse files
committed
revert: feat(ngForm): Supports expression in form names
This reverts commit 4407e81. No features or breaking changes in the stable branch please.
1 parent db87fd5 commit dbcc44d

2 files changed

Lines changed: 4 additions & 29 deletions

File tree

src/ng/directive/form.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,13 +306,13 @@ var formDirectiveFactory = function(isNgForm) {
306306
alias = attr.name || attr.ngForm;
307307

308308
if (alias) {
309-
setter(scope, alias, controller, alias);
309+
scope[alias] = controller;
310310
}
311311
if (parentFormCtrl) {
312312
formElement.bind('$destroy', function() {
313313
parentFormCtrl.$removeControl(controller);
314314
if (alias) {
315-
setter(scope, alias, undefined, alias);
315+
scope[alias] = undefined;
316316
}
317317
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
318318
});

test/ng/directive/formSpec.js

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,10 @@ describe('form', function() {
8383
});
8484

8585

86-
it('should support expression in form name', function() {
86+
it('should allow form name to be an expression', function() {
8787
doc = $compile('<form name="obj.myForm"></form>')(scope);
8888

89-
expect(scope.obj).toBeDefined();
90-
expect(scope.obj.myForm).toBeTruthy();
89+
expect(scope['obj.myForm']).toBeTruthy();
9190
});
9291

9392

@@ -326,30 +325,6 @@ describe('form', function() {
326325
});
327326

328327

329-
it('should deregister a child form whose name is an expression when its DOM is removed', function() {
330-
doc = jqLite(
331-
'<form name="parent">' +
332-
'<div class="ng-form" name="child.form">' +
333-
'<input ng:model="modelA" name="inputA" required>' +
334-
'</div>' +
335-
'</form>');
336-
$compile(doc)(scope);
337-
scope.$apply();
338-
339-
var parent = scope.parent,
340-
child = scope.child.form;
341-
342-
expect(parent).toBeDefined();
343-
expect(child).toBeDefined();
344-
expect(parent.$error.required).toEqual([child]);
345-
doc.children().remove(); //remove child
346-
347-
expect(parent.child).toBeUndefined();
348-
expect(scope.child.form).toBeUndefined();
349-
expect(parent.$error.required).toBe(false);
350-
});
351-
352-
353328
it('should deregister a input when its removed from DOM', function() {
354329
doc = jqLite(
355330
'<form name="parent">' +

0 commit comments

Comments
 (0)