Skip to content

Instantly share code, notes, and snippets.

@jeneg
Last active August 29, 2015 14:17
Show Gist options
  • Save jeneg/a3c77a4708ddb78f95ef to your computer and use it in GitHub Desktop.
Save jeneg/a3c77a4708ddb78f95ef to your computer and use it in GitHub Desktop.
Function for alphabetical sort of Angular dependency injections
/**
* Function for alphabetical sort of Angular dependency injections
*/
(function() {
var arr = ['$state', '$stateParams', '$rootScope', '$timeout',
'$templateCache', '$compile', 'googleMapService',
'actionCreateService', '$filter', 'configModel'];
arr.sort(function (a, b) {
a = a.replace('$', '');
b = b.replace('$', '');
if (a < b) { return -1; }
if (a > b) { return 1; }
return 0;
});
console.log("'" + arr.join("', '") + "'");
console.log(arr.join(', '));
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment