How read from Firebase Database


#1

Hi! I’m trying to get data from Firebase DataBase.

I have the firebase.init.js file:

angular.module(‘firebaseConfig’, [‘firebase’])

.run(function(){

var config = {
apiKey: “MyApiKey”,
authDomain: “MyDomain”,
databaseURL: “MyDatabaseURL”,
projectId: “MyProjectID”,
storageBucket: “MyLink.appspot.com”,
messagingSenderId: “MyNumbers”
};
firebase.initializeApp(config);

})

NOTE: I have filled all the parameters with my database info.

I want use that database connection into a page, so the code in page is:

function ($scope, $stateParams, $firebaseArray) {
var ref = firebase.database().ref().child(“events”); // database is named events
$scope.events = $firebaseArray(ref);
}

Is that database connection correct? How I read from that database config?

Thanks

Regards


#2

See:


#3

Hi @robinyo,

Thanks for the response.

I using the Ionic Creator, not CLI version. Is no way to use that in Creator version?