- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 240
 
Closed
Description
When using If else in html, the components that shouldn't be visible don't seem to be removed. Instead each time the condition changes a new ng template gets generated. This creates multiple versions of the same templates over time.
Here is an example:
<ActionBar title="My App" class="action-bar">
</ActionBar>
<StackLayout class="page">
  <Placeholder *ngIf="size < 6; then small else big"> 
  </Placeholder>
  <ng-template #small>
    <Label text="Small"></Label>
  </ng-template>
  <ng-template #big>
    <Label text="Big"></Label>
  </ng-template>
  <Label [text]="size"></Label>
  
  <Button text="+" (tap)="add()" class="btn btn-primary"></Button>
  <Button text="-" (tap)="sub()" class="btn btn-primary"></Button>
</StackLayout>
export class ItemsComponent {
  size: number = 5;
  constructor() { }
  add() {  this.size++; }
  sub() {  this.size--; }
}