I need to do a ng-repeat on a subarray (inside an element of an array). This is the data;
{familyName:'Vodka', familyCode:'1', hasPremium: '1', families: [
{ subFamilyName: 'Best', products: [
{ title: 'Grey goose 70 cl', price: '400', cant: '0', premium: '1' },
{ title: 'Grey goose 1,5l', price: '875', cant: '0', premium: '0' }
]},
{ subFamilyName: 'Poor', products: [
{ title: 'Grey goose 10 cl', price: '40', cant: '0', premium: '0' },
{ title: 'Grey goose 17,5l', price: '85', cant: '0', premium: '0' }
]}
]},
{familyName:'Rum', familyCode:'1', hasPremium: '1', families: [
{ subFamilyName: 'Best', products: [
{ title: 'Grey goose 70 cl', price: '400', cant: '0', premium: '1' },
{ title: 'Grey goose 1,5l', price: '875', cant: '0', premium: '0' }
]},
{ subFamilyName: 'Poor', products: [
{ title: 'Grey goose 10 cl', price: '40', cant: '0', premium: '0' },
{ title: 'Grey goose 17,5l', price: '85', cant: '0', premium: '0' }
]}
]
Perfect. I have in my $scope one var called selectedFamily which saves the family Code selected with navigation purposes. Now, in a I need to print the subfamilies of the selected family (coded in selectedFamily var) and the products of each of that subfamilies.
I was thinking how too filter and do the ng-repeat.