Reputation: 408
i used the *ngif on a button that will be false and came true when the item is selectd from ng-select but its not working
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 whole code of 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>
Upvotes: 1
Views: 4785
Reputation: 21367
try this:
(selected)="selected($event);switch=true"
you can use hidden that way: it should work
[hidden]="switch"
Upvotes: 1