Skip to content

Instantly share code, notes, and snippets.

@spoeken
Last active December 27, 2015 14:09
Show Gist options
  • Save spoeken/7338502 to your computer and use it in GitHub Desktop.
Save spoeken/7338502 to your computer and use it in GitHub Desktop.
Angular AngularFire Obj to Array so that one can filter them objects Thank you https://github.com/finalclass // https://github.com/angular/angular.js/issues/1286#issuecomment-22193332
// To Array Filter
// https://github.com/angular/angular.js/issues/1286#issuecomment-22193332
$scope.toArray = function () {
return function (obj) {
if (!(obj instanceof Object)) {
return obj;
}
return Object.keys(obj).map(function (key) {
return Object.defineProperty(obj[key], '$key', {__proto__: null, value: key});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment