Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import {
  2. Component,
  3. Input,
  4. trigger,
  5. state,
  6. style,
  7. transition,
  8. animate } from '@angular/core';
  9. import {AngularFire, FirebaseListObservable} from 'angularfire2';
  10.  
  11. @Component({
  12. selector: 'list-add',
  13. template: `
  14. <input #item /><button (click)="add(item.value)">Add</button>
  15. `
  16. })
  17. export class Add {
  18. items: FirebaseListObservable<any[]>;
  19. constructor(af: AngularFire) {
  20. this.items = af.database.list('/items');
  21. }
  22. add(item: string){
  23. this.items.push({
  24. name: item
  25. });
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement