Last active
December 27, 2015 14:09
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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