diff --git a/itenium-socks/src/app/socks/sock-reviews.component.html b/itenium-socks/src/app/socks/sock-reviews.component.html
index 696aab3..40de199 100644
--- a/itenium-socks/src/app/socks/sock-reviews.component.html
+++ b/itenium-socks/src/app/socks/sock-reviews.component.html
@@ -1,3 +1,12 @@
+@if ((reviews$ | async)?.length === 0){
+
+
+
+ Be the first to review these fantastic socks!
+
+
+
+} @else {
@@ -40,3 +49,4 @@
On {{ review.added }} by {{ review.email }}
+}
diff --git a/itenium-socks/src/app/socks/sock-reviews.component.ts b/itenium-socks/src/app/socks/sock-reviews.component.ts
index fe89cb9..5380823 100644
--- a/itenium-socks/src/app/socks/sock-reviews.component.ts
+++ b/itenium-socks/src/app/socks/sock-reviews.component.ts
@@ -1,5 +1,5 @@
import { AsyncPipe, NgFor } from '@angular/common';
-import { Component } from '@angular/core';
+import {Component, Input} from '@angular/core';
import { Observable } from 'rxjs';
import { SocksService } from './socks.service';
import { Review } from './sock.model';
@@ -11,11 +11,16 @@ import { Review } from './sock.model';
templateUrl: './sock-reviews.component.html'
})
export class SockReviewsComponent {
+ @Input() sockId!: number | undefined;
reviews$!: Observable;
constructor(private socksService: SocksService) {}
ngOnInit(): void {
- this.reviews$ = this.socksService.getLatestReviews();
+ if(this.sockId){
+ this.reviews$ = this.socksService.getSockReviews(this.sockId);
+ } else {
+ this.reviews$ = this.socksService.getLatestReviews();
+ }
}
}
diff --git a/itenium-socks/src/app/socks/sock.component.html b/itenium-socks/src/app/socks/sock.component.html
index b40f9d2..aaf704d 100644
--- a/itenium-socks/src/app/socks/sock.component.html
+++ b/itenium-socks/src/app/socks/sock.component.html
@@ -47,7 +47,7 @@ {{ sock.name }}
-
+