I have a problem with ngFor
because I want to enable the + button only when an item in the list is selected. But my option
element does not accept event bind (click)
. Can you help me?
<div class="container">
<div class="row">
<button (click)="setItem()">Items</button>
<select class="custom-select">
<option *ngFor="let item of itemSelecionado">{{ item }}</option>
</select>
</div>
</div>
<div class="container">
<button class="btn btn-primary" type="button" [disabled]="isActive">+</button>
</div>
itemSelecionado = [];
items = ['Teste A', 'Teste B', 'Teste C', 'Teste D', 'Teste E'];
isActive = true;
setItem(){
this.itemSelecionado = this.items;
console.log(this.itemSelecionado);
}
I already tried to create the method below and use it in option
, but it did not work:
liberaBtn() {
this.isActive = false;
}