$scope.add = function(){
$scope.playerCards.push(Deck.drawCard());
if (playerScore > 21){
console.log("You Busted!");
newHand();
}
};
In this blackjack game, the DOM automatically updates to reflect the players hand using ngRepeat
. However, there isn't a window of time to allow the last card to show before the >21
logic executes. I'm guessing angular doesn't have time to run through ng-repeat
. How can I force it to update as soon as the data updates? I tried $scope.$digest()
but it throws an error about about something else being in progress.