Skip to content

Instantly share code, notes, and snippets.

@jeneg
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save jeneg/a3c77a4708ddb78f95ef to your computer and use it in GitHub Desktop.

Select an option

Save jeneg/a3c77a4708ddb78f95ef to your computer and use it in GitHub Desktop.

Revisions

  1. jeneg revised this gist Mar 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Angular DI sort function
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    (function() {
    var arr = ['$state', '$stateParams', '$rootScope', '$timeout',
    '$templateCache', '$compile', 'googleMapService',
    'appleCreateService', '$filter', 'configModel'];
    'actionCreateService', '$filter', 'configModel'];

    arr.sort(function (a, b) {
    a = a.replace('$', '');
  2. jeneg revised this gist Mar 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Angular DI sort function
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    (function() {
    var arr = ['$state', '$stateParams', '$rootScope', '$timeout',
    '$templateCache', '$compile', 'googleMapService',
    'assetCreateService', '$filter', 'configModel'];
    'appleCreateService', '$filter', 'configModel'];

    arr.sort(function (a, b) {
    a = a.replace('$', '');
  3. jeneg revised this gist Mar 24, 2015. 1 changed file with 17 additions and 16 deletions.
    33 changes: 17 additions & 16 deletions Angular DI sort function
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,19 @@
    /**
    * Function for alphabetical sort of Angular dependency injections
    */
    (function() {
    var arr = ['$state', '$stateParams', '$rootScope', '$timeout', '$templateCache',
    '$compile', 'googleMapService', 'assetCreateService', '$filter', 'configModel'];
    /**
    * Function for alphabetical sort of Angular dependency injections
    */
    (function() {
    var arr = ['$state', '$stateParams', '$rootScope', '$timeout',
    '$templateCache', '$compile', 'googleMapService',
    'assetCreateService', '$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;
    });
    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(', '));
    }());
    console.log("'" + arr.join("', '") + "'");
    console.log(arr.join(', '));
    }());
  4. jeneg created this gist Mar 24, 2015.
    18 changes: 18 additions & 0 deletions Angular DI sort function
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    /**
    * Function for alphabetical sort of Angular dependency injections
    */
    (function() {
    var arr = ['$state', '$stateParams', '$rootScope', '$timeout', '$templateCache',
    '$compile', 'googleMapService', 'assetCreateService', '$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(', '));
    }());