I'm using a ng-change directive to get an object that change. When i get it i have to check if exists in another array of objects, and if it does i have to delete from it. what can i do? i tried with indexOf but it didn't work.
//@Param ObjectItem: change object from UI using ng-change
$scope.itemValue = function (ObjectItem) {
//collection of required items
var requiredItem = dataPublicationService.getRequired();
//check if item exist in collection. DIDN'T WORK!
if(requiredItem.indexOf(publi) !== -1){
//get found index
var idx = requiredItem.indexOf(publi);
//delete founded item.
requiredItem.splice(idx, 1);
}
};
What other solution can i implement?