Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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.