I think this should do the trick.
<div ng-repeat="obj in array | unique : 'type'">
<h3 ng-bind="obj.type"></h3>
<span ng-bind="obj.value"></span>
</div>
Check it out and see if it works.
Edit : You would need the angular.filter module for this
Update:
Looking at the updated question, I think it might be difficult for you to achieve the operation given(using a single iteration to list out all the values by unique type).
But you can do one thing, group the array by type using this pure JS function(similar to @Claies answer):
var custom_sort = function(arr){
var a = arr.slice(0);
var ret = [];
var same_type = false;
while (a.length != 0){
var item = a.shift();
if(ret.length > 0){
for(var i = 0; i < ret.length; i++){
if(ret[i].type == item.type){
ret[i].value.push(item.value);
same_type = true;
}
}
}
if(!same_type){
ret.push({type : item.type, value : [item.value]});
}
same_type = false;
}
return ret;
}
The output array that you will get is like this:
[
{ type: 'a', value: [ '234', '5566' ] },
{ type: 'b', value: [ '778' ] },
{ type: 'c', value: [ '899' ] },
{ type: 'k', value: [ '5644' ] }
]
And from there, do the iteration like this:
<div ng-repeat="obj in array">
<h3 ng-bind="obj.type"></h3>
<div ng-repeat="v in obj.value">
<span ng-bind="v"></span>
</div>
</div>
Hope it helps.
obj.nameand notobj.value??valueto match a giventype. It sounds more like you are wanting to group these together, which would require a secondng-repeat. Can you clarify which you are trying to achieve?234and5566, not234twice; still, it will take 2<span>elements instead of one and anotherng-repeatto accomplish something close to what you are expecting. also, it requires changing your data structure somewhat. My recommended solution is to use underscore.js to help us here; I'll work up a sample and post an answer soon.