I have html like this :
<td><span ng-if="isuser(user) == false" type="button" >not allowed</span> </td>
the above html is displayed only if the function isuser(user) return false.
I have an array like this :
$scope.list = ["456", "111", "459"];
Now the user object has an array called id. This id array contains a number key whose value can be 456,111 or 459 and sometimes it may be empty also.
The user object :
{"name":"pravin","status":"Live","id":[{"number":"111"}],"msg":"test"}
Here is the isuser function :
$scope.isuser = function(user) {
for (var i = 0; i < $scope.list.length; i++){
var exists = user.id.find(({number}) => number === $scope.list[i]);
}
if (exists)
return true;
else
return false;
};
but this always returns false.
I want the for loop to check if none of the values of the number key exists in the list array and then only return false. How do I do it?
user.idarray.