Instantly share code, notes, and snippets.

Embed
What would you like to do?
<input type="text" [(ngModel)]="todo" class="form-control" />
<hr />
<button class="btn btn-primary btn-block" (click)="aFireService.add(todo); todo = ''">AÑADIR TODO</button>
<hr />
<div *ngIf="(todos | async); let data">
<table class="table" *ngIf="data.length > 0">
<thead>
<tr>
<th>ID</th>
<th>TODO</th>
<th>DELETE</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let todo of data">
<td>{{ todo.id }}</td>
<td>{{ todo.todo }}</td>
<td>
<button class="btn btn-danger" (click)="aFireService.remove(todo.id)">DELETE</button>
</td>
</tr>
</tbody>
</table>
<div *ngIf="data.length === 0" class="alert alert-danger text-center">NO HAY TODOS</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment