0
我想切換活動並停用按鈕中的類。例如對於參考link,在這個我有5個按鈕,當我點擊第一個按鈕刪除最後一個按鈕,我如何刪除點擊按鈕?以及如何實現切換激活和停用類?激活和取消激活按鈕,刪除列表angular2
<ion-item>
<ion-label >Add</ion-label>
<ion-input type="text" value="" #newTag (keyup.enter)="addTag(newTag.value)" (blur)="addTag(newTag.value); newTag.value='' "></ion-input>
</ion-item>
<button (click)=addTag(newTag.value)>Add</button>
<button *ngFor="let category of categories" ion-button >{{category}} <span (click)="delete()">X</span></button>
file.ts
@Input()
newTag: any;
categories = ['Windstorm', 'Bombasto', 'Magneta', 'Tornado'];
addTag(newTag: string) {
if (newTag) {
this.categories.push(newTag);
}
}
delete() {
var index = this.categories.indexOf(this.newTag);
this.categories.splice(index, 1);
}
http://www.jqueryscript.net/demo/Simple-Mobile-Friendly-jQuery-Tags-Input-Plugin-Taxonomy/我的專家是這樣的,當點擊按鈕活動,當我點擊這個 X當前列表刪除列表。不隱藏並顯示輸入框 – sridharan
使用索引進行拼接。 –
謝謝..關於切換的任何想法激活和停用按鈕 – sridharan