<div ng-repeat="item in Items">
<button ng-init="checkIfDisabled[item.name] = true"
ng-disabled ="checkIfDisabled[item.name] ===true "></button>
</div>
In my project, I am working with a variable called cart that contains objects. The objective is to have the button enabled only if any of the objects in the cart variable match the item being displayed on the page.
When adding items to the cart, this code snippet was used:
var itemname = item.name;
$rootScope.checkIfDisabled[itemname] = false;
However, it seems this approach is not achieving the desired outcome. Is there an alternative solution?
The buttons are initially disabled but remain so even after the value changes to false.