Guest User

Untitled

a guest
Dec 12th, 2018
1,330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <div id="auctions" [@fadeAnimation]="recentAuctions.length">
  2. <ng-container *ngIf="!loadingAuctions; else loading">
  3. <div class="auction" *ngFor="let auction of recentAuctions">
  4. <img [src]="auction.images[0]">
  5. <p>{{auction.title}}</p>
  6. <p style="color: #ff9800;">{{auction.price | currency:'DKK':'code':'1.2-2':'da'}}</p>
  7. <p>{{auction.timeLeft.days}} dage,
  8. {{auction.timeLeft.hours}}:{{auction.timeLeft.minutes}}:{{auction.timeLeft.seconds}}</p>
  9. </div>
  10. </ng-container>
  11. </div>
  12. </div>
  13. <ng-template #loading>
  14. <mat-progress-spinner mode="indeterminate" diameter="75"></mat-progress-spinner>
  15. </ng-template>
  16.  
  17. ngOnInit() {
  18. this.firestore.collection<Auction>('open-auctions', ref => ref.orderBy("startDate", "desc").limit(5)).get().subscribe(res => {
  19. res.docs.forEach(doc => {
  20. let auction = <Auction>doc.data();
  21. this.setTimeLeft(auction);
  22. this.recentAuctions.push(auction);
  23. this.countdowns.push(
  24. interval(1000).subscribe(result => {
  25. this.setTimeLeft(auction)
  26. console.log(auction.title);
  27. })
  28. );
  29. })
  30. this.loadingAuctions = false;
  31. });
  32. }
Add Comment
Please, Sign In to add comment