Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Bug in angular.FormController when nesting ng-form's #9035

Closed
@Joel-Kornbluh

Description

@Joel-Kornbluh

When using $removeControl to remove a nested ng-form, the inner form still holds a reference to parentForm, (specifically those 3 methods: $setValidity, $setDirty and $setSubmitted). So, when the validity state of the nested (isolated) form changes, it will also affect the parentForm, even though it was removed.

Here is a Demo
http://plnkr.co/edit/uiUjwB?p=preview

Occurences of parentForm referenced in nested form/control
addSetValidityMethod
FormController.$setDirty
FormController.$setSubmitted

Suggested Fix
In above mentioned methods, add if(parentForm[form.$name]){/*do*/} before changing parentForm to check if it still holds a reference to the nested form/control

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions