Good afternoon guys, Something that should be simple and I can not. I am querying my database in firebase, where it has 2 records saved. I do the search and appear returns the data in the console, using console.log (), BUT, I can not display this data on the screen, where they should appear !!!
app.controller('ListagemCtrl', function($scope, $rootScope, $location, $firebaseObject){
$rootScope.activetab = $location.path();
$scope.filmesCadastrados = [];
firebase.database().ref('filmes/').once('value').then(function (snapshot) {
for(var id in snapshot.val()){
var filme = snapshot.val()[id];
console.log(filme);
$scope.filmesCadastrados.push(filme);
}
});
});
And here's my HTML:
<div ng-controller="ListagemCtrl">
<table class="table table-striped" >
<tbody>
<tr>
<th>Título do Filme</th>
<th>Diretor</th>
<th>Categoria</th>
<th>Duração</th>
</tr>
<tr ng-repeat="filme in filmesCadastrados">
<td>{{filme.titulo}}</td>
<td>{{filme.diretor}}</td>
<td>{{filme.categoria}}</td>
<td>{{filme.duracao}}</td>
</tr>
</tbody>
</table>
</div>