Reputation: 87
I have created this demo, in which I have three buttons. These are generated through for loop running on backend response.
all the buttons are clickable and turning activate and deactivate with click event but what logic should I have to use to make only one button active at a time. (it should work like toggle button but these are not the toggle buttons)
so the selection of anyone button will make other 2 deactivate.
Please see the demo code on like below,
updated code / current working logic
Upvotes: 0
Views: 1095
Reputation: 5040
I have modified the code, make it like this
someMethod(something) {
this.groupOfButton.forEach(btn => {
btn['active'] = (btn.number === something.number);
});
}
Upvotes: 1