i wanted to delete index from array if rest service response return true , so in below case lets say we have true from rest service i wanted to delete object where id is 'RA_ATTST_LANGUAGE` from array. I tried below code but its not deleting what is missing ?
main.js
MessageAdminNotificationFactory.getAttestationLanValidation().then(function(response){
var data = response.data;
console.log('attestation',data);
if(data){
angular.forEach($scope.adminDataSource,function(value,$index){
if(value.id === 'RA_ATTST_LANGUAGE'){
$scope.adminDataSource.splice($index, 1);
}
console.log('dropdown',value.id);
});
}
});
$scope.adminDataSource = [{
"uid": null,
"index": 0,
"selected": null,
"expanded": null,
"id": "RA_PLTFRM_NOTIF",
"text": "Platform Maintenance Notification",
"parentId": null,
"items": null
}, {
"uid": null,
"index": 0,
"selected": null,
"expanded": null,
"id": "RA_ATTST_LANGUAGE",
"text": "Attestation Language",
"parentId": null,
"items": null
}]