app.component.html
489 Bytes
<div>
<form (ngSubmit)="add()">
<input type="text" [(ngModel)]="newTodo" name="newTodo" placeholder="New TODO">
<button type="submit" *ngIf="newTodo" [disabled]="newTodo?.trim().length === 0">Add</button>
</form>
<br />
<ul>
<li *ngFor="let todo of todos$ | async | pairs" (click)="delete(todo[0])">{{todo[1]}}</li>
</ul>
<button (click)="sub()" *ngIf="!todosSub">Log in console</button>
<button (click)="unsub()" *ngIf="!!todosSub">Stop logging</button>
</div>