In Angular:
I have the below JSON object:
$scope.catItems = [
{cat: 'A', desc: 'lorem ipsum', tags: '', name: 'abc', link: 'www.google.com'},
{cat: 'B', desc: 'I am here too', tags: '', name: 'def', link: 'www.google.com'},
{cat: 'C', desc: 'So am I', tags: '', name: 'ghi', link: 'www.google.com'},
{cat: 'D', desc: 'Where is the sky', tags: '', name: 'jkl', link: 'www.google.com'},
{cat: 'A', desc: 'I really don't know', tags: '', name: 'mno', link: 'www.google.com'},
{cat: 'A', desc: 'So do I', tags: '', name: 'pqr', link: 'www.google.com'},
{cat: 'C', desc: 'Tell the next person', tags: '', name: 'stu', link: 'www.google.com'},
{cat: 'B', desc: 'So will I', tags: '', name: 'vwx', link: 'www.google.com'}
];
You can see how same cat's like lets say cat-A is repeated more than twice in the object or some cat's are only repeated twice or even less.
I wanted to see if we can based on Cat from above object, parse them into one array like below and also remove duplicates from the list generated:
$scopt.cats = [];
for (items in $scope.catItems){
if ($scope.cats.indexOf(item.cat) < 0){
$scope.cats.push(item.cat);
}
}
And display them in the below:
<ul data-ng-repeat="items in cats">
<li>
<p class="search-title">{{items}}</p>
</li>
</ul>
Also, if possible display each individuals properties below them.