Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. getInvoices() {
  2. this.invCollection = this.afs.collection('invoices');
  3. this.invoices = this.invCollection.snapshotChanges().pipe(
  4. shareReplay(1),
  5. map(actions => {
  6. return actions.map(action => ({
  7. key: action.payload.doc.id,
  8. ...action.payload.doc.data()
  9. }))
  10. })
  11. )
  12.  
  13. this.invList = this.invoices.source;
  14.  
  15. <mat-form-field class="ffield">
  16. <mat-select (selectionChange)="getInv($event)" placeholder="Choose invoice">
  17. <mat-option *ngFor="let invoice of invoices | async; trackBy: trackByFn" [value]="invoice.key">{{invoice.invNo}}</mat-option>
  18. </mat-select>
  19. </mat-form-field>
  20.  
  21.  
  22. getInv(e) {
  23. this.sID = e.value; //id of selected invoice
  24.  
  25. //TODO filter this.invList observable }
  26.  
  27. this.invList.pipe(map(aaa => {return aaa.map(bbb => ())}), filter(flt => flt.key === this.sID)).subscribe(sss => (console.log(sss.invNo)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement