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.

SCOPE DESTRUCTION: Leak when asynchronously continuing the linking of directives on scopes that are already destroyed #9199

Closed
@lgalfaso

Description

@lgalfaso

When a directive uses a templateUrl, this directive is inside an ng-switch or an ng-if and the following events happen in this specific order

  • The html of the ng-switch starts it's compilation
  • The directive inside the ng-switch starts it's compilation, the template is requested from the server
  • The synchronous part of the compilation ends
  • The condition on the ng-switch changes so the directive should be displayed
  • ng-switch transcludes the content of the ng-switch-when (only what it can as the template did not finish loading)
  • The expression at ng-switch changes so the directive should not be displayed
  • ng-switch destroys the scope
  • The template finishes loading, the scope (even when it is already destroyed) is added to the element.data (here is where we have the leak)

Here is a plunker that shows this
http://plnkr.co/edit/tNMYYHgoebX1Vx0hWZAb?p=preview

Note: This issue is based on a modification of #9197

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions