All files / src/app/extensions/quoting/pages/quote-list quote-list-page.component.ts

100% Statements 11/11
75% Branches 6/8
100% Functions 3/3
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 321x 1x     1x               1x       3x   3x     3x       2x 2x   3x      
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, DestroyRef, OnInit, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { Observable } from 'rxjs';
 
import { QuotingFacade } from '../../facades/quoting.facade';
import { Quote, QuoteRequest } from '../../models/quoting/quoting.model';
 
@Component({
  selector: 'ish-quote-list-page',
  templateUrl: './quote-list-page.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class QuoteListPageComponent implements OnInit {
  loading$: Observable<boolean>;
  quotes: (Quote | QuoteRequest)[];
 
  private destroyRef = inject(DestroyRef);
 
  constructor(private quotingFacade: QuotingFacade, private cd: ChangeDetectorRef) {}
 
  ngOnInit() {
    this.quotingFacade
      .quotingEntities$()
      .pipe(takeUntilDestroyed(this.destroyRef))
      .subscribe(quotes => {
        this.quotes = quotes;
        this.cd.detectChanges();
      });
    this.loading$ = this.quotingFacade.loading$;
  }
}