0
Hello! I’m learning to use Angularjs now, but I’m already an experienced programmer on Android.
I correctly receive data from firebase, but the ng-repeat
does not update when the array is changed. If I click on some other field it updates...
javascript
receiving data from the firebase
.
$scope.notas = [ ];
var retrieveNotas = function () {
firebase.database().ref("notas").on('value', function(snapshot) {
snapshot.forEach(function (child) {
$scope.notas.push(child.val());
});
console.log($scope.notas)
});
};
table with ng-repeat
<table class="table">
<tr class="tdAlign" ng-show="notas.length > 0">
<th></th>
<th>Nome</th>
<th>Data</th>
<th>Cliente</th>
<th>Valor</th>
</tr>
<tr class="tdAlign" ng-class="{selecionado: nota.selecionado}" ng-repeat="nota in notas | filter:busca">
<td><input type="checkbox" ng-model="nota.selecionado"></td>
<td>{{nota.nome | uppercase}}</td>
<td>{{nota.data}}</td>
<td>{{nota.cliente.fantasia}}</td>
<td>{{nota.valor | currency}}</td>
</tr>
</table>