No datas coming from Firebase : todo list tuto


#1

Hi !

I’m really angry against myself because I can’t figure it out. My problem is I need to use firebase for a big project, but it’s my first time with it, and with noSQL. So I started the Todo list tutorial using ionic creator (https://www.youtube.com/watch?v=IrwrZBBOiP8&list=PLG71uQ6L5PWNOsIDFrP3X-_s-W4T6vBzP).

My problem is, I set the database like this (and “.read”: “auth != true”,
".write": “auth != true” properties) :

enter image description here

Tried, like that :

enter image description here

Here you can find the service I use and how I call it on todos pages :

//todos.js file

angular.module('todos', ['firebase'])

.run(function(){

  // Initialize Firebase
  var config = {
    apiKey: "//",
    authDomain: "//",
    databaseURL: "//",
    storageBucket: "//",
  };
  firebase.initializeApp(config);

})


.service("Todos", ["$firebaseArray", function($firebaseArray){
    var ref = firebase.database().ref().child("todos");
    var items = $firebaseArray(ref);
    
    var todos = {
        items: items,
        addItem: function(title){
            items.$add({
                title: title,
            })
        },
        setFinished: function(item, newV){
            item.finished = newV;
            items.$save(item);
        }
    }
    return todos;
}]);
// todos page

function ($scope, $stateParams, Todos) {

    $scope.items = Todos.items;
}


// Finished item page

function ($scope, $stateParams, Todos) {
    
    $scope.items = Todos.items;
}


// todo item page

function ($scope, $stateParams) {

    $scope.itemid = $stateParams.items;

}

And I still have no datas coming from Firebase, I tried to print “Todos.items” in the console, but there are too many fields in this array, I can’t find my datas. When starting the app, I have these blanks pages but no errors :

enter image description here


#2

Am planning to have a play with Firebase in the next week or so. If I get anywhere with it, I’ll let you know! Likewise, if you manage to figure this out, do reply!


#3

Hello, I have an issue like this. Did you solve the problem?