title: angular 2 countup timer
body: <p>Can some one give me count-up timer example in angular and thanks in advance</p>
  
  <p>I have this TypeScript code when I add this to my project nothing happens</p>
  
  <pre class="lang-ts prettyprint-override"><code>var minutesLabel = document.getElementById("minutes");
  var secondsLabel = document.getElementById("seconds");
  var totalSeconds = 0;
  setInterval(setTime, 1000);
  
  function setTime() {
      ++totalSeconds;
      secondsLabel.innerHTML = pad(totalSeconds%60);
      minutesLabel.innerHTML = pad(parseInt(totalSeconds/60));
  }
  
  function pad(val) {
      var valString = val + "";
      if(valString.length &lt; 2) {
          return "0" + valString;
      } else {
          return valString;
      }
  }
  </code></pre>