Child events in the Firebase Database are fired asynchronously, which is a problem out of the box in Angular 1.x. You will either need to to trigger the $digest loop directly after adding to the array or use AngularFire. I recommend you use AngularFire.
Vanilla SDK approach
function MyController($scope) {
var ref = firebase.database.ref('items');
var items = [];
ref.on('child_added', function(snap) {
$scope.$evalAsync(function() {
var item = snap.val();
// use a super private property to keep around the key
item.__key = snap.key;
items.push(item);
});
});
}
AngularFire approach
function MyController($scope, $firebaseArray) {
var ref = firebase.database.ref('items');
// Handles all child events: added, removed, changed, moved
$scope.items = $firebaseArray(ref);
}