Ok, heres the pickle:
Im using ng-repeat to iterate through the menu items:
<!-- start the list/loop -->
<ion-list ng-repeat="this in menuItems.items track by $index" type="item-text-wrap">
<a class="item" ng-click="addToCart({{this}})">{{this.name}}
<span class="badge badge-stable">{{theCart[$index].product.qty}}</span>
</a>
</ion-list>
<!-- end the list/loop -->
The problem arises when I try to get the value out of the item in the cart 'theCart[$index].product.qty' since the $index is not bound to any particular item, just the position in the array. I need to get to a unique identifier 2 objects deep in the array so I can be sure to get the correct values with the two-way data binding Angular is so nice to provide.
theCart: [{
product: {
id: 1,
section: 'sides',
name: 'mayo',
price: 7,
outOfStock: '',
qty: 1
}
}, {
product: {
id: 0,
section: 'sides',
name: 'ranch',
price: 6,
outOfStock: '',
qty: 1
}
}];
Thanks in advance for any insight.