I need to implement a feature where only one button can be selected at a time from a list of buttons. When no button is selected, I want to disable another button elsewhere on the page.
Below is the code snippet for the buttons:
<button type="button" ng-repeat="service in services_data track by service.id" ng-class="showDetails[service.id] ? 'bg-success': 'bg-default'" ng-init="selected[service.id] = false" ng-click="showDetails[service.id] = showDetails[service.id]; select_check(showDetails)" class="list-group-item item_buttons">
<ul class="list-unstyled">
<li>{{service.name}} - {{service.est_time_mins}} mins. | ${{service.price}}</li>
<li>{{service.style}}</li>
</ul>
</button>
A click on any button toggles the "showDetails" variable, setting it to TRUE if the button is selected and FALSE if deselected.
I am trying to write a function that checks the status of all buttons to determine when to disable a specific button. However, my attempts with loops and conditional statements have not been successful so far.