Skip to content
This repository was archived by the owner on Sep 16, 2022. It is now read-only.
This repository was archived by the owner on Sep 16, 2022. It is now read-only.

@deferred under a <template> is not removed when the <template> is #1539

@leonsenft

Description

@leonsenft

Consider the following example:

<button (click)="show = !show">Toggle</button>
<div *ngIf="show">
  <hello-world @deferred></hello-world>
</div>

Pressing the Toggle button will alternate between adding and removing the <hello-world> component from the DOM. This behavior is broken, if this example is changed so that the parent element of the @deferred component is itself a <template>:

<button (click)="show = !show">Toggle</button>
<template [ngIf]="show">
  <hello-world @deferred></hello-world>
</template>

Now rather than alternating between adding and removing the <hello-world> component, pressing the Toggle button will alternative between adding and doing nothing. This means new <hello-world> components will be repeatedly appended to the DOM.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions