I have the following function:
$scope.calcularTotal = function(startDate, endDate){
$scope.items = $filter('betweenDate')($scope.items, 'dataPagamento', startDate, endDate);
console.log("testee: "+$scope.items)
var total = 0;
var glosa = 0;
var lote = 0;
angular.forEach($scope.items, function(item) {
total += (item.totalLiquido);
glosa +=(item.totalGlosa);
lote +=(item.totalLote);
});
$scope.totalLiquido = total;
$scope.totalGlosa = glosa;
$scope.totalLote = lote;
console.log("Total: "+$scope.total)
$state.go('tabs.facts', {}, {reload: true});
}
In this function I go through an Array and make the sum of the values. In the% of% that has at the end the total appears correctly. But when I try to do Data Binding on my page the values do not appear:
This is the page:
ion-view title="Totais" cache-view="false">
<ion-content has-header="true" padding="true">
<h3 style="text-align:center">Total</h3>
<p style="margin-top:30px;font-weight:bold;color: #0066FF">Total Lote: {{totalLote | currency}}</p>
<p style="font-weight:bold;color: #990000">Total Glosa: {{totalGlosa | currency}}</p>
<p style="font-weight:bold;color: #339900">Total Líquido: {{totalLiquido | currency}}</p>
</br>
</br>
</br>
</br>
<p>
<a class="button icon ion-home" href="#/tab/home" style="width:100%"> Home</a>
</p>
</ion-content>
</ion-view>
And this is the result:
How could you solve this problem?