No this won’t be possible, because
is a character not an integer.
I’ve solve my problem ! 
I used ng-show to hide and show the heart lives 
I connected the life variable that every time it decrements it hides one of the heart life 
<font color="red" ng-show="life1">♥</font>
<font color="red" ng-show="life2">♥</font>
<font color="red" ng-show="life3">♥</font>
<font color="red" ng-show="life4">♥</font>
<font color="red" ng-show="life5">♥</font>
$scope.life--;
if($scope.life == 4){
$scope.life1 = false;
}else if($scope.life == 3){
$scope.life2 = false;
}else if($scope.life == 2) {
$scope.life3 = false;
}else if($scope.life == 1) {
$scope.life4 = false;
}else if($scope.life == 0) {
$scope.life5 = false;
}
Hi @emsee71,
Well I would solve it differently because you are repeating a lot. You need to have a variable to store the number of hearts, a method to decrease the value and a method to display the number of hearts showing “
” characters.
In your controller:
$scope.life = 5;
$scope.decreaseLife = function() {
$scope.life--;
};
$scope.printLife = function() {
return new Array($scope.life + 1).join("♥");
};
In your view:
Number of hearts: {{ life }} <br/>
<div ng-click="decreaseLife()">{{ printLife() }}</div>
This will render like:
Number of hearts: 5





Click or press the hearts and they will decrease.
1 Like
Wow, Thanks for making it more easily to solve my problem
, THank you very much ! 