{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/angularfire/issues/629","labels_url":"https://api.github.com/repos/firebase/angularfire/issues/629/labels{/name}","comments_url":"https://api.github.com/repos/firebase/angularfire/issues/629/comments","events_url":"https://api.github.com/repos/firebase/angularfire/issues/629/events","html_url":"https://github.com/firebase/angularfire/issues/629","id":90222270,"number":629,"title":"$firebaseArray.extend with promise, $loaded data not available","user":{"login":"dreadjr","id":565652,"avatar_url":"https://avatars.githubusercontent.com/u/565652?v=3","gravatar_id":"","url":"https://api.github.com/users/dreadjr","html_url":"https://github.com/dreadjr","followers_url":"https://api.github.com/users/dreadjr/followers","following_url":"https://api.github.com/users/dreadjr/following{/other_user}","gists_url":"https://api.github.com/users/dreadjr/gists{/gist_id}","starred_url":"https://api.github.com/users/dreadjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dreadjr/subscriptions","organizations_url":"https://api.github.com/users/dreadjr/orgs","repos_url":"https://api.github.com/users/dreadjr/repos","events_url":"https://api.github.com/users/dreadjr/events{/privacy}","received_events_url":"https://api.github.com/users/dreadjr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/firebase/angularfire/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-06-22T21:51:56Z","updated_at":"2015-06-25T20:35:26Z","closed_at":"2015-06-23T21:21:35Z","body":"I am experiencing an issue when i extend a firebaseArray, if use directly, it works as expected. Tried to make into small application below.\r\n\r\nrelated items: [#596]\r\nplunkr: http://plnkr.co/edit/jFpxUk\r\n\r\n```\r\nfirebase@2.2.7\r\nangular@1.3.16\r\nangularfire@1.1.1\r\n```\r\n\r\n```\r\nvar myAppModule = angular.module('myApp', ['firebase']);\r\n\r\nmyAppModule.controller('GreetingController', ['$scope', '$firebaseArray', '$q', function($scope, $firebaseArray, $q) {\r\n  var url = \"https://todomvc-angular.firebaseio.com/todos\";\r\n  var TestExtendArrayPromise = $firebaseArray.$extend({\r\n\t\t$$added: function (snap, prevChild) {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\treturn $q(function(resolve, reject) {\r\n\t\t  // return new Promise(function(resolve, reject) {\r\n\t\t\t\tvar record = $firebaseArray.prototype.$$added.call(self, snap, prevChild);\r\n\t\t\t\tconsole.log(record);\r\n\t\t\t\treturn resolve(record);\r\n\t\t\t});\r\n\t\t}\r\n\t});\r\n\t\r\n\tvar TestExtendArrayNoPromise = $firebaseArray.$extend({\r\n\t\t$$added: function (snap, prevChild) {\r\n\t\t\tvar self = this;\r\n\r\n\t\t\tvar record = $firebaseArray.prototype.$$added.call(self, snap, prevChild);\r\n\t\t  return record;\r\n\t\t}\r\n\t});\r\n\r\n  // THIS DOESN'T WORK\r\n\t$scope.list = TestExtendArrayPromise(new Firebase(url).limitToFirst(100));\r\n\t$scope.list.$loaded().then(function() {\r\n\t\tconsole.log('keyAt_1', $scope.list.$keyAt(0));\r\n\t\tconsole.log('$$ilst_1', $scope.list.length);\r\n\t});\r\n\t\r\n// \t$scope.list = TestExtendArrayNoPromise(new Firebase(url).limitToFirst(100));\r\n// \t$scope.list.$loaded().then(function() {\r\n// \t\tconsole.log('keyAt_2', $scope.list.$keyAt(0));\r\n// \t\tconsole.log('$$ilst_2', $scope.list.length);\r\n// \t});\r\n\t\r\n\t// THIS WORKS\r\n// \t$scope.list = $firebaseArray(new Firebase(url).limitToFirst(100));\r\n// \t$scope.list.$loaded().then(function() {\r\n// \t\tconsole.log('keyAt_3', $scope.list.$keyAt(0));\r\n// \t\tconsole.log('$$ilst_3', $scope.list.length);\r\n// \t});\r\n}]);\r\n```\r\n\r\nWhen i extend the array the `loaded()` appears to fire before the data is actually loaded. Maybe i am just doing something wrong. Any ideas?"},"comment":{"url":"https://api.github.com/repos/firebase/angularfire/issues/comments/115389729","html_url":"https://github.com/firebase/angularfire/issues/629#issuecomment-115389729","issue_url":"https://api.github.com/repos/firebase/angularfire/issues/629","id":115389729,"user":{"login":"katowulf","id":959972,"avatar_url":"https://avatars.githubusercontent.com/u/959972?v=3","gravatar_id":"","url":"https://api.github.com/users/katowulf","html_url":"https://github.com/katowulf","followers_url":"https://api.github.com/users/katowulf/followers","following_url":"https://api.github.com/users/katowulf/following{/other_user}","gists_url":"https://api.github.com/users/katowulf/gists{/gist_id}","starred_url":"https://api.github.com/users/katowulf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katowulf/subscriptions","organizations_url":"https://api.github.com/users/katowulf/orgs","repos_url":"https://api.github.com/users/katowulf/repos","events_url":"https://api.github.com/users/katowulf/events{/privacy}","received_events_url":"https://api.github.com/users/katowulf/received_events","type":"User","site_admin":false},"created_at":"2015-06-25T20:35:26Z","updated_at":"2015-06-25T20:35:26Z","body":"We'll put something together. Hang in there."}}