I would like to display an array using ngFor but before the first element I want to display a card (the user can click inside to show a modal)
Here the code :
<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>
This code doesn't work. It shows the first element (my card) and the second element like this :
Any idea ? Thank you very much !
EDIT :
ngFor loop products :
first loop => my card "add product"
second loop => product A
EDIT 2 : You'll find the answer to this here : Align mat-cards content (image, text and buttons)