hi all,
i tray to draw a dynamic grid,
and need to exclude some duplicate items.
i’m using http.post, parsing a data and displaying a grid, as bellow.
every thing work fine, except excluding duplicate (key,value).
- Total grid are (data.nbr_cellule) = 40
- Total Elements via wsAPI.getElements = 10
- each wsAPI.getElements element has a cellule id
i need a solution to check if ( $scope.items[i].cellule != i )=> don’t work.
(
duplicate ids :
- 10
- 13
- 19
- 31
- 32
…
)
thanks a lot
wsAPI.getElements(params).then(function(data) {
$scope.items = data.Elements;
if ( data.statut == 1 ) {
for (var i = 0; i < data.nbr_cellule; i++) {
if( $scope.items[i].cellule != i) {
$scope.items.push(
{
"statut":"",
"conseils":"",
"video":"",
"cellule":i,
"image": "",
"code_html": "#eeeeee",
"code_rgb": "",
"idt":""
}
);
}
}
}
},function(){
$scope.error = true;
});