2
Good afternoon, you guys, Something that should be simple and I can’t. I’m checking my database at firebase, where you have two records stored. I do the search and appear returns the data in the console, using console.log(), HOWEVER, I can not display this data on the screen, where it 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 this is 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>
Show me what’s on
console
.log please– Sorack
Shows the output of your console.log
– fernandoocf
I just posted what the console displays.
– GustavoSevero
Object {category: "FIC", director: "Jon Favreau", duration: 130, title: "Iron Man"}category: "FIC"director: "Jon Favreau"duration: 130title: "Iron Man"proto: Object controllerr.js:38 Object {category: "FIC", director: "George Lucas", duration: 150, title: "Star Wars"}
– GustavoSevero
@Gustavosevero where you put the
tag
ng-app
in your HTML?– Sorack
in <html ng-app="app">
– GustavoSevero
Fix your post, you have 2 ng-controller
– fernandoocf
I fixed it, thanks.
– GustavoSevero