title: How to custom sort JSON array in Typescript or Angular
body: <p>How to sort JSON array in Angular? The array:</p>
  
  <pre><code>{"title":"DEASDFS","Id":11},
  {"title":"AASDBSC","Id":2},
  {"title":"JDADKL","Id":6},
  {"title":"MDASDNO","Id":3},
  {"title":"GHFASDI","Id":15},
  {"title":"HASDFAI","Id":1},
  {"title":"ASDHFI","Id":9},
  </code></pre>
  
  <p>I want the order of the Id's like this:</p>
  
  <p><strong>15,6,1,11,9,2,3</strong></p>
  
  <pre><code>&lt;div *ngFor="let field of fieldsData;let i=index;"&gt;
    &lt;div class="form-inline assigned_text-box" [ngSwitch]="field.Id"&gt;
  
      &lt;div class="col-md-2" *ngSwitchCase="15"&gt;
        &lt;label&gt;One&lt;/label&gt;
      &lt;/div&gt;
      &lt;div class="col-md-2" *ngSwitchCase="6"&gt;
        &lt;label&gt;Two&lt;/label&gt;
      &lt;/div&gt;
      &lt;div class="col-md-2" *ngSwitchCase="1"&gt;
        &lt;label&gt;Three&lt;/label&gt;
      &lt;/div&gt;
      &lt;div class="col-md-2" *ngSwitchCase="11"&gt;
        &lt;label&gt;Four&lt;/label&gt;
      &lt;/div&gt;
      &lt;div class="col-md-2" *ngSwitchCase="9"&gt;
        &lt;label&gt;Five&lt;/label&gt;
      &lt;/div&gt;
      &lt;div class="col-md-2" *ngSwitchCase="2"&gt;
        &lt;label&gt;Six&lt;/label&gt;
      &lt;/div&gt;
      &lt;div class="col-md-2" *ngSwitchCase="3"&gt;
        &lt;label&gt;Seven&lt;/label&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>But when I use <code>ngSwitch</code> conditio,n which ever coming first that is printing 
  so it coming like as present in JSON <strong>11,2,6,3,15,1,9</strong></p>
  
  <p><strong>But</strong> I want this order <strong>15,6,1,11,9,2,3</strong>. How can I achieve this custom sort array?</p>