title: orderBy sorting by string AND integer on ng-repeat in angular 1.5.0
body: <p>I've got an angular 1.5 project, and upgrading isn't really an option right now.  I'm trying to simply sort a collection of items such as:</p>
  
  <pre><code>"Bar #1 // #1A", 
  "Foo #1 // #1A", 
  "Foo #1 // #1B", 
  "Foo #2 // #2", 
  "Foo #2 // #10",
  "Foo #10 // #1", etc
  </code></pre>
  
  <p>...</p>
  
  <p><a href="https://code.angularjs.org/1.5.0/docs/api/ng/filter/orderBy" rel="nofollow noreferrer">Angular 1.5.0's docs</a> say:  </p>
  
  <blockquote>
    <p>Array: An array of function or string predicates. The first predicate in the array is used for sorting, but when two items are equivalent, the next predicate is used.</p>
  </blockquote>
  
  <p>So, I first tried just doing:</p>
  
  <pre><code>ng-repeat="item in items | orderBy: sortFunc"
  </code></pre>
  
  <p>where the sort function does:</p>
  
  <pre><code>scope.sortFunc = function (item) {                                                                                                                                   
    var replaced = item.name.replace(/(\d+)/g, ',\$1');                                                                                                                
    return replaced.split(',').map(function (fragment) {                                                                                                                          
      var number = parseInt(fragment, 10);                                                                                                                            
      return number ? Number(number) : fragment;
    });
  };
  </code></pre>
  
  <p>I am returning an array such as ["Bar #", 1, " // #", 1, "A"].  So I thought this would work exactly as they described..  When two items are equivalent, the next is used.</p>
  
  <p>But I guess it doesn't support a function returning an array..........  It needs to be an array of functions, but I have no way to generate an array of functions based off of a string's components.....................................................</p>
  
  <p>So is there any way to do what I am trying to do?</p>