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.

NgMessages: Messages that are not attached to the DOM before being dynamically removed don't deregister from the parent controller #16389

Closed
@CodySchaaf

Description

@CodySchaaf

I'm submitting a ...

  • bug report
  • feature request
  • other

Current behavior:
When messages are removed from the dom via ng-if, if they haven't been rendered by ngMessages they do not unsubscribe from the controller. This causes a memory leak, and in my application errors which lead to infinite digests.

See Plnkr for repro:

https://plnkr.co/edit/vG7DxmXLjuzfZUF11ypB?p=preview

Expected / new behavior:
The messages that are removed should unsubscribe.

Minimal reproduction of the problem with instructions:
Add an ngMessages directive that adds a template with an ng-if to remove errors on input focus. This is done to fix a jaws issue where errors are continually repeated as a user is typing when they are only hidden via css.

https://plnkr.co/edit/vG7DxmXLjuzfZUF11ypB?p=preview

AngularJS version: 1.x.y
Still an issue.

Browser:
All

Anything else:
I have started working on a solution here CodySchaaf@20bbb17 , but I currently have failing tests. I will continue to play around with it but, any suggestions would be appreciated. I suspect it has something to do with the issue that was originally solved with the $$attachId.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions