Hello! I'm learning Angularjs now, but I'm already an experienced Android programmer.
I get the data from the firebase correctly, but the ng-repeat
does not update when the array is changed. If I click on some other field it updates ...
javascript
that receives data from 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>