|
9 | 9 | // |
10 | 10 | // * `ref`: A Firebase reference. Queries or limits may be applied. |
11 | 11 | // * `config`: An object containing any of the advanced config options explained in API docs |
12 | | - .factory("$firebase", [ "$firebaseUtils", "$firebaseConfig", |
13 | | - function ($firebaseUtils, $firebaseConfig) { |
| 12 | + .factory("$firebase", [ "$log", "$firebaseUtils", "$firebaseConfig", |
| 13 | + function ($log, $firebaseUtils, $firebaseConfig) { |
14 | 14 | function AngularFire(ref, config) { |
15 | 15 | // make the new keyword optional |
16 | 16 | if (!(this instanceof AngularFire)) { |
|
202 | 202 | ref.on('child_removed', removed, error); |
203 | 203 |
|
204 | 204 | // determine when initial load is completed |
205 | | - ref.once('value', function() { resolve(null); }, resolve); |
| 205 | + ref.once('value', function(snap) { |
| 206 | + if (angular.isArray(snap.val())) { |
| 207 | + $log.warn('Storing data using array indices in Firebase can result in unexpected behavior. See https://www.firebase.com/docs/web/guide/understanding-data.html#section-arrays-in-firebase for more information.'); |
| 208 | + } |
| 209 | + |
| 210 | + resolve(null); |
| 211 | + }, resolve); |
206 | 212 | } |
207 | 213 |
|
208 | 214 | // call resolve(), do not call this directly |
|
281 | 287 |
|
282 | 288 | function init() { |
283 | 289 | ref.on('value', applyUpdate, error); |
284 | | - ref.once('value', function() { resolve(null); }, resolve); |
| 290 | + ref.once('value', function(snap) { |
| 291 | + if (angular.isArray(snap.val())) { |
| 292 | + $log.warn('Storing data using array indices in Firebase can result in unexpected behavior. See https://www.firebase.com/docs/web/guide/understanding-data.html#section-arrays-in-firebase for more information.'); |
| 293 | + } |
| 294 | + |
| 295 | + resolve(null); |
| 296 | + }, resolve); |
285 | 297 | } |
286 | 298 |
|
287 | 299 | // call resolve(); do not call this directly |
|
0 commit comments