I found several similar topics, but most of them are deprecated because I am using angularfire 1.1.1.
I had an AngularJS application creating markers on a Google map. The data was saved in external JSON files, and it worked perfectly when I turned it into arrays. When I put the data in the firebase database, it stopped working. The ng data directives work very well, but when accessing the data of the array data in js code, it really does not work.
app.controller('MapCtrl', ['$scope', '$firebaseArray', function($scope, $firebaseArray){
var ref = new Firebase("https://radiant-inferno-6439.firebaseio.com/tracks");
var syncObject = $firebaseArray(ref);
...
When registering the old stand-alone JSON file, the syncObject looked like this:
[Object, Object, Object]
0: Object
1: Object
2: Object
length: 3
__proto__: Array[0]
But now it looks like this:
[]
0: Object
1: Object
2: Object
$$added: () { [native code] }
$$error: () { [native code] }
$$getKey: () { [native code] }
$$moved: () { [native code] }
$$notify: () { [native code] }
$$process: () { [native code] }
$$removed: () { [native code] }
$$updated: () { [native code] }
$add: () { [native code] }
$destroy: () { [native code] }
$getRecord: () { [native code] }
$indexFor: () { [native code] }
$keyAt: () { [native code] }
$loaded: () { [native code] }
$ref: () { [native code] }
$remove: () { [native code] }
$save: () { [native code] }
$watch: () { [native code] }
length: 3
__proto__: Array[0]
Why is that? When I print the length of the array, it says 0. I tried the function $ loaded, but that does not affect.
syncObject.$loaded().then(function(syncObject) {
console.log(syncObject.length);
});
I also cannot access the properties of the array, so it cannot be scrolled.