I do not know how to write my condition in angular and I can not find an equate example.
How i can listen to my material selection ?
How I write a ngIf condition ?
{{referentielToDisplay.speSS}} have a equal value of one of my toppingList, i want to write :
if ReferentielToDisplay. speSS is equal to an item selected in the material selection so: display this card
*ngIf="referentielToDisplay.speSS === topping"
Component.html
<mat-form-field style="width:100%" appearance="outline">
<mat-label>Sélectionner une spécialité</mat-label>
<mat-select placeholder="Toppings" [formControl]="toppings" multiple="true" >
<mat-option *ngFor="let topping of toppingList" [value]="topping" >{{topping}}</mat-option>
</mat-select>
</mat-form-field>
<div *ngFor="let referentielToDisplay of referentielsToDisplay | async" >
<mat-card *ngIf="referentielToDisplay.speSS === topping">
{{referentielToDisplay.nomSS}}
</mat-card>
</div>
Component.ts
toppings = new FormControl( );
toppingList: string[] = ['Multi-spécialité','Hématologie', 'Neurologie', 'Urologie', 'Digestif', 'Endocrinologie', 'Pneumologie', 'ORL','Dermatologie', 'Sein-Gynecologie'];
*ngIf="toppings.value.includes(referentielToDisplay.speSS)"
It's not totaly the solution but it is the way !!