I implemented *ngif on a button to show/hide it based on a condition, but it's not working as expected. The button should appear when an item is selected from ng-select.
Here is the button code:
<button *ngIf="switch" (click)="productSaveInCart()" type="button" class="col matbuton " mat-button>
ADD to Cart
</button>
And here is the entire code of the Modal:
<ng-template #template>
<div class="modal-header">
<h4 class="modal-title pull-left">{{modaldata.i.i}}</h4>
<button type="button" class="close btn pull-right" aria-label="Close" (click)="modalRef2.hide()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<mat-card style="margin: 0; ">
<img height="400px" style="width: 110%" mat-card-image [src]="modaldata.i.t || '../../assets/images/noimage.png'">
<mat-card-footer class="row">
<h4>Extra prep. time: 1hr</h4>
<ng-select [allowClear]="true" [items]="items" [disabled]="disabled" (data)="refreshValue($event)" (selected)="selected($event)"
(removed)="removed($event)" (typed)="typed($event)" placeholder="No Date selcted">
</ng-select>
<div *ngFor="let item of list ">
<h4 class="col">{{item.n}}</h4>
<app-dropdowns #child class="col" [listdata]="item"></app-dropdowns>
</div>
<button *ngIf="switch" (click)="productSaveInCart()" type="button" class="col matbuton " mat-button>
ADD to Cart
</button>
</mat-card-footer>
</mat-card>
</div>
</ng-template>