Guest User

Untitled

a guest
Jan 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. private sprintCollection: AngularFirestoreCollection<Sprint>;
  2. private itemDoc: AngularFirestoreDocument<any>;
  3. sprints: Sprint[] = [];
  4. item:any[]=[];
  5.  
  6. constructor( private afs: AngularFirestore ) {
  7. this.sprintCollection = this.afs.collection<Sprint>('Sprints');
  8. }
  9.  
  10. getSprint(value:string){
  11. this.sprintCollection = this.afs.collection('Sprints', ref => ref.where('Application', '==', value) )
  12. return this.sprintCollection.valueChanges();
  13. }
  14.  
  15. getSprints(){
  16. return this.sprintCollection.valueChanges();
  17. }
  18.  
  19. addSprint( sprint:Sprint){
  20. return this.sprintCollection.add(sprint);
  21. }
  22.  
  23. this._sp.getSprints().subscribe(data=>{
  24. for(let key$ in data){
  25. let h =data[key$]
  26. h.key$ = key$
  27. this.sprintGrid.push(data[key$]);
  28. }
  29. });
  30.  
  31. <table class="table table-hover table-sm">
  32. <thead>
  33. <tr>
  34. <th scope="col">Sprint</th>
  35. <th scope="col">Aplication</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. <tr *ngFor="let sprint of sprintGrid; let i = index">
  40. <td>{{ sprintGrid[i].Sprint }}</td>
  41. <td>{{ sprintGrid[i].Application }}</td>
  42. <td>
  43. <button kendoButton style="background-color: #ffc107; color:white" class="col-lg-4" [icon]="'edit'" ></button>
  44. <button kendoButton style="background-color: #dc3545; color:white" (click)="delete(sprintGrid[i].key$)" class="col-lg-4" [icon]="'delete'" ></button>
  45. </td>
  46. </tr>
  47. </tbody>
  48. </table>
Add Comment
Please, Sign In to add comment