title: Modify scope variable
body: <p>I had a string variable in php with this value <code>000001422</code> and I used to modify it in order to display it in a better way:</p>
  
  <pre><code>&lt;?php
  $hits = "000001422";
  $var = (int)$hits;
  $var = abbreviateNumber($var);
  echo $var; ?&gt;
  </code></pre>
  
  <p>This is the function to crop and abbreviate the number in something like <code>1,4k</code></p>
  
  <pre><code>function abbreviateNumber(value) {
      var newValue = value;
      if (value &gt;= 1000) {
          var suffixes = ["", "k", "m", "b","t"];
          var suffixNum = Math.floor( (""+value).length/3 );
          var shortValue = '';
          for (var precision = 2; precision &gt;= 1; precision--) {
              shortValue = parseFloat( (suffixNum != 0 ? (value / Math.pow(1000,suffixNum) ) : value).toPrecision(precision));
              var dotLessShortValue = (shortValue + '').replace(/[^a-zA-Z 0-9]+/g,'');
              if (dotLessShortValue.length &lt;= 2) { break; }
          }
          if (shortValue % 1 != 0)  shortNum = shortValue.toFixed(1);
          newValue = shortValue+suffixes[suffixNum];
      }
      return newValue;
  }
  </code></pre>
  
  <p>This worked great.</p>
  
  <p>Now I'm trying to switch my code to AngularJS (I'm still learning it) so my value it's not a php variable but a scope variable received from an $http request. I have something like <code>{{x.count}}</code> which is my <code>000001422</code> but I would like to display it in the same way I did before.</p>
  
  <p>I tryed to <code>$hits = "{{x.count}}";</code> but it's not working and I think it's not the right approach. Can you address me in the right way to handle this? </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I removed the initial zeros converting the value into an int with <code>{{x.count - 0}}</code> but still need to apply my abbreviate function.</p>