mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
revert: feat(ngForm): Supports expression in form names
This reverts commit 4407e81c61.
No features or breaking changes in the stable branch please.
This commit is contained in:
parent
db87fd52ca
commit
dbcc44dc80
2 changed files with 4 additions and 29 deletions
|
|
@ -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
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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">' +
|
||||
|
|
|
|||
Loading…
Reference in a new issue