this is a sample of cart page generated from html code with Angular 5
<div *ngFor="let cart of carts; let i=index" class="panel"
id="product-panel">
//some other lines
<div class="panel-foot col-xs-12">
<div class="col-md-8 btns-group">
<button type="button" class="btn btn-default col-md-3 col-xs-12">
<i class="fa fa-trash-o"></i> Remove</button>
<button type="button" class="btn btn-primary col-md-3 col-xs-12">
<i class="fa fa-shopping-cart"></i> checkout</button>
<button (click)="edit(i)" type="button" class="btn btn-success col-md-3 col-xs-12">
<i class="fa fa-refresh"></i> Edit</button>
</div>
<div class="col-md-4">
<div class=" qty col-xs-12">
<input [disabled]="!disable" id="qty-number" type="number" value="{{quantity}}" class="float-right col-md-3 col-xs-8 ">
<div class="float-right plus-minus">
<div class="plus" (click)="plus()">
<i class="fa fa-plus"></i>
</div>
<div class="minus" (click)="minus()">
<i class="fa fa-minus"></i>
</div>
</div>
</div>
</div>
</div>
</div>
By default qty1&qty2 are disabled i want when the user click on edit inn the first product just qty1 is enable and so one. I have tried many methods but all qty are enabled
How i can do this?
disablevariable for both inputs. Try having this disable variable as an attribute of your cart. Same goes with thequantityvariable as your value. Otherwise, bothquantityanddisablefields will be the shared for all carts. Then you'll be able to do<input [disabled]="!cart.qtyDisabled" value="{{cart.quantity}}" />