I'm new in Angularjs and I'm developing a kind of shopping cart I have and array:
$scope.products = [
{id: '141', name: 'Apple', qty:0},
{id: '223', name: 'Orange', qty:0},
{id: '398', name: 'Banana', qty:0}];
By design limitation I need to do something like
<input type="text" ng-model="products[productID].qty"/>
(I can't use array element index I know it works.)
I've tried also with
ng-model="(p in products | filter: {id:'223'}).qty"
But I couldn't make it work
Please Could you help me ??
I will explain my shopping cart Let imagine that I need a table in the columns the sizes:s,m,l, xl in the rows models, but there are models that are manufactured in all sizes so I will have an input in every cell, but there are some that are only in l and xl and other in s and m So I will have a table with some empty cells. I know I can have a table that works as metadata where I can define columns, rows and the mapping and then develop a directive. My idea is design the table in HTML and assign to each cell the productID