|
431 | 431 | } |
432 | 432 | } |
433 | 433 |
|
| 434 | + // Call handlers for the "loaded" event. |
| 435 | + if (self._loaded !== true) { |
| 436 | + self._loaded = true; |
| 437 | + self._broadcastEvent("loaded", value); |
| 438 | + } |
| 439 | + |
434 | 440 | switch (typeof value) { |
435 | 441 | // For primitive values, simply update the object returned. |
436 | 442 | case "string": |
|
440 | 446 | break; |
441 | 447 | // For arrays and objects, switch to child methods. |
442 | 448 | case "object": |
| 449 | + self._fRef.off("value", gotInitialValue); |
443 | 450 | // Before switching to child methods, save priority for top node. |
444 | 451 | if (snapshot.getPriority() !== null) { |
445 | 452 | self._updateModel("$priority", snapshot.getPriority()); |
446 | 453 | } |
447 | 454 | self._getChildValues(); |
448 | | - self._fRef.off("value", gotInitialValue); |
449 | 455 | break; |
450 | 456 | default: |
451 | 457 | throw new Error("Unexpected type from remote data " + typeof value); |
452 | 458 | } |
453 | | - |
454 | | - // Call handlers for the "loaded" event. |
455 | | - self._loaded = true; |
456 | | - self._broadcastEvent("loaded", value); |
457 | 459 | }; |
458 | 460 |
|
459 | 461 | self._fRef.on("value", gotInitialValue); |
|
620 | 622 | // If the new local value matches the current remote value, we don't |
621 | 623 | // trigger a remote update. |
622 | 624 | var local = self._parseObject(self._parse(name)(scope)); |
623 | | - if (self._object.$value && |
| 625 | + if (self._object.$value !== undefined && |
624 | 626 | angular.equals(local, self._object.$value)) { |
625 | 627 | return; |
626 | 628 | } else if (angular.equals(local, self._parseObject(self._object))) { |
|
0 commit comments