title: How to initialize values in angular2 typescript
body: <p>I have a class 'Rank' which contains a loses attribute and a wins attribute. Both of them are collected from a web service. I want to calculate the points attribute depending on them.</p>
  
  <p>For Excample:</p>
  
  <pre><code>for(int i = 0; i&lt;loses; i++{
     points += 1;
  }
  for(int i = 0; i&lt;wins; i++{
     points += 2;
  }
  </code></pre>
  
  <p><strong>Rank Class</strong></p>
  
  <pre><code>class Rank{
    $id?:number;
    loses?:number;
    team?:string;
    wins?:number;
    points: number;
  
    constructor(){}
  }
  </code></pre>
  
  <p>Where I have to put the logic?</p>