2
Hello, everyone, I’m a beginner in angular, and I’d like to know what I’m doing wrong here. Check it out: Every time I click on a button I want it to add some "modified" information of an object called a match on the bet object. The problem is that actually, instead of adding it to it.
That is the function:
$scope.fazAposta = function(partida, tipo) {
var time;
var partidaA = partida.timeCasa + " x " + partida.timeFora;
var cotacaoA;
var idpart = partida.idPartida;
switch (tipo) {
case 1:
cotacaoA = partida.cotTimeC;
time = partida.timeCasa;
break;
case 2:
cotacaoA = partida.cotTimeF;
time = partida.timeFora;
break;
case 0:
cotacaoA = partida.cotEmp;
time = "Empate";
break;
}
$scope.apostas = [
{timeApostado: time, partidaApostada: partidaA, cotacaoApostada: cotacaoA, idDaPartida: idpart}
];
$scope.apostas.push(angular.copy(apostas));
}
Ah, if necessary in any way, the starting object is coming by ajax made by one of a php script.
Here’s where I’m displaying some bet information:
<h3 id="apH3">Apostas Simples</h3>
<div class='apostado' ng-repeat="aposta in apostas track by $index">
<h1 name='time'>{{aposta.timeApostado}}</h1>
<h2 name='partida'>{{aposta.partidaApostada}}</h2>
<h2 name='cotacaoApostada'>{{aposta.cotacaoApostada}}</h2>
</div>
</div>
Thank you so much! I kind of used your two answers.
– Krint
A lot of nothing, we’re here to help =)
– Thiago Santos