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.

Form object properties are not deleted #14510

@Tobbe

Description

@Tobbe

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Angular leaves undefined object properties that should have been deleted

Demo: http://jsfiddle.net/Tobbe/8eohL2nq/2/

First press one of the "RemoveChild" buttons, then press "Trigger Error". Watch the output in your browser's console.

What is the expected behavior?

Seeing as Angular automatically adds the entire object property (i.e. vm.forms.formId0 and vm.forms.formId1 in the demo above) when the corresponding form is dynamically created, it should be completely removed (deleteed) when the form is dynamically removed.

What is the motivation / use case for changing the behavior?

Looping over the object with the generated forms should not cause JS errors. ("TypeError: Cannot read property '$valid' of undefined" in this case)

Which versions of Angular, and which browser / OS are affected by this issue?

Angular 1.4.6
Chrome Version 49.0.2623.112 m
Windows 7 Pro SP1

Also confirmed on latest snapshot (AngularJS v1.5.6-build.4771+sha.c95a3d8)

Have not tried with earlier version of Angular

Other information (e.g. stacktraces, related issues, suggestions how to fix)

No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions