Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created May 26, 2018 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/4ed35ac508346d70bea88fa6e8ee072f to your computer and use it in GitHub Desktop.
Save uno-de-piera/4ed35ac508346d70bea88fa6e8ee072f to your computer and use it in GitHub Desktop.
<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