If i find values in object i want to delete those values from array.
What would be the best solution to accompolished this task ?
ctrl.js
var selectedOwners = [];
$scope.deleteOwner = function(dataItem){
var workerKey;
var fullName;
angular.forEach(selectedOwners,function(val,index){
workerKey = val.workerKey;
fullName = val.fullName;
})
if(dataItem.workeyKey === workerKey || dataItem.fullName === fullName){
selectedOwners.splice(workerKey,fullName);
}
}
Array and Object
Array selectedOwners = [{"fullName":"Johnson, Rocio","workerKey":3506},{"fullName":"Johnson, John S.","workerKey":571},{"fullName":"Johnson, Camille A.","workerKey":1368}]
Object {
"workerKey": 3506,
"fullName": "Johnson, Rocio",
}