Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

fix _parseObject() that got broken because of angular/angular.js#6253 #320

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions angularfire.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,23 +765,24 @@
// Parse a local model, removing all properties beginning with "$" and
// converting $priority to ".priority".
_parseObject: function(obj) {
function _findReplacePriority(item) {
function _handleSpecialKeys(item) {
for (var prop in item) {
if (item.hasOwnProperty(prop)) {
if (prop == "$priority") {
item[".priority"] = item.$priority;
delete item.$priority;
} else if (prop[0] == "$") {
delete item[prop];
} else if (typeof item[prop] == "object") {
_findReplacePriority(item[prop]);
_handleSpecialKeys(item[prop]);
}
}
}
return item;
}

// We use toJson/fromJson to remove $$hashKey and others. Can be replaced
// by angular.copy, but only for later versions of AngularJS.
var newObj = _findReplacePriority(angular.copy(obj));
// We use toJson/fromJson to handle special cases, such as Date
var newObj = _handleSpecialKeys(angular.copy(obj));
return angular.fromJson(angular.toJson(newObj));
}
};
Expand Down
2 changes: 1 addition & 1 deletion angularfire.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.