I wanna synchronize firebase table with ionic list.
These are items on database
Items
-KQpA9YpXyqBQ2HZedEo
name: "jhj"
-KQpAWtIaMeS93431BRQ
name: "hj"
-KQpB6grRt15GnacKHjW
name: "j"
This is ionic part
<ion-list>
<ion-item ng-repeat="item in items">
<h2>{{item.name}}</h2>
</ion-item>
</ion-list>
Here is my firebase part
var itemsRef = firebase.database().ref('Items');
//first try
var items = itemsRef.orderByChild('name');
$scope.items = items;
//this is second try
itemsRef.on('child_added', function (data) {
$scope.items = data.val();
});
If I try something like this I can see Items on console.
var items = itemsRef.orderByChild('name');
items.on('child_added', function (snapshot) {
var obj = snapshot.val();
console.log(obj);
});
I need help to get and show the list on ionic.