Make img carousel work
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
<div class="gameCard" *ngFor="let product of Products">
|
||||
<div style="position: relative;">
|
||||
<div *ngIf="product.images.length > 1">
|
||||
<button class="gameCard-Prev" onclick="">❮</button>
|
||||
<button class="gameCard-Next" onclick="">❯</button>
|
||||
<button class="gameCard-Prev" (click)="nextImg(product)">❮</button>
|
||||
<button class="gameCard-Next" (click)="prevImg(product)">❯</button>
|
||||
</div>
|
||||
<div *ngIf="product.images.length > 0" >
|
||||
<img class="gameCard-Img" [src]="product.images[product.curShowingIMG].imageSrc">
|
||||
|
||||
@@ -40,6 +40,20 @@ export class CatalogComponent {
|
||||
)
|
||||
};
|
||||
|
||||
nextImg( prod: Product ){
|
||||
prod.curShowingIMG += 1;
|
||||
if (prod.curShowingIMG == prod.images.length){
|
||||
prod.curShowingIMG = 0;
|
||||
}
|
||||
}
|
||||
|
||||
prevImg( prod: Product ){
|
||||
prod.curShowingIMG -= 1;
|
||||
if (prod.curShowingIMG == -1){
|
||||
prod.curShowingIMG = prod.images.length -1;
|
||||
}
|
||||
}
|
||||
|
||||
DeleteItem( ProductID: number ) {
|
||||
const body = new HttpParams()
|
||||
.set("productID", ProductID);
|
||||
|
||||
@@ -72,7 +72,8 @@ namespace MistoxWebsite.Server.Controllers {
|
||||
obj.Images = building.ToArray();
|
||||
await _databaseService.NewProduct(obj);
|
||||
return true;
|
||||
} catch {
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user