Can someone explain what I’m doing wrong here?
Controller has the following…
.controller('ScoreCtrl',function($scope){
$scope.scores.total = [];
$scope.scores[0].total = 0;
$scope.scores[1].total = 0;
function addpoints(params){
if(params = 1){
$scope.scores[0].total=$scope.scores[0].total + 1;
}
if(params = 2){
$scope.scores[1].total=$scope.scores[1].total + 1;
}
};
function getpoints(params){
if(params = 1){
return scores[0];
}
if(params = 2){
return scores[1];
}
};
})
For the html view I just want to display score[0].total and score[1].total
<ion-content ng-controller="ScoreCtrl">
<div class="" >Team A: {{score[0].total}} Points</div>
<div class="">Team B: {{score[1].total}} Points</div>
</ion-content>
This doesn’t display anything, I’m assuming I have to use ng-repeat or try to use a function (like the get points one I’ve created?)
Help a newb out?
Thanks