Is there a way to display an array using ngFor, but have a card displayed before the first element that opens a modal when clicked?
https://i.sstatic.net/6QG0D.png
Here is the code snippet for reference:
<div fxFlex="25" *ngFor="let product of products; let i = index">
<div *ngIf="i == 0">
<mat-card (click)="addProduct()" class="mat-card-add-button">
<div fxLayout="row" fxLayoutAlign="center center" fxFlex="100%">
<span style="font-size:32px;text-align:center">+<br />Add product</span>
</div>
</mat-card>
</div>
<div fxLayoutAlign="center stretch">
<mat-card class="product">
<img mat-card-image src="{{product.picture.url}}" alt="photo">
<mat-card-title>{{product.name}}</mat-card-title>
<mat-card-content>
<p>
{{product.description}}
</p>
</mat-card-content>
<mat-card-actions align="end">
</mat-card-actions>
</mat-card>
</div>
</div>
Currently, the code displays the first element (the card) and the second element like this:
https://i.sstatic.net/FmHia.png
Any suggestions on how to fix this issue? Thank you!
EDIT :
ngFor loop products :
first loop => my card "add product"
second loop => product A
EDIT 2 : For assistance with alignment of mat-cards content, refer to this post: Align mat-cards content (image, text and buttons)