SHARE
TWEET

Untitled

a guest Jun 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top