Been trying to get a property from a user but keep getting stuck. Any help would be appreciated.
In the ‘removeConfirm’ variable I want the name property of a user. The selectedPlayer holds the _id
of the user and I’m trying to use that as a search basis. Kind of search using the supplied id and return the object so I can reference the name property.
‘click .remove’: function(){
var selectedPlayer = Session.get(‘selectedPlayer’);
var playerName = PlayersList.find(selectedPlayer).fetch();
var removeConfirm = confirm('Whoa! hang on, do you really want to delete ' + playerName.name);
console.log(playerName);
if(removeConfirm == true){
PlayersList.remove(selectedPlayer);
}
}