Lets say there is an object(game) that has an array with objects(players) and if the player array has a certain value(_id) that equals the current value I want to hide a button(join).
game object:
{
"_id":"123459595",
"players":[
{
"_id":"some_id",
"name":"some_username"
}
]
}
I know I can hide the button like:
<button ng-hide="playerJoined">Join game</button>
Where playerJoined is a statement that checks if the players is in the array. I have acces to the current player value from the variable currentPlayer that is available from the $rootScope.
How should I check if the currentPlayer exists as a value in the array with players?