title: OTP verification 2 minutes count down timer
body: <p>I need to stop time by 02.00 to 0.00. But it stopped in -1.59 or started decrement onwards. In angular typescript i wrote above code. what i did wrong:</p>
  
  <pre><code>&lt;html&gt;
    &lt;body&gt;
      &lt;input type="text" name="otp" placeholer="Enter your otp"/&gt;
      &lt;div&gt;Time left = &lt;span id="timer"&gt;&lt;/span&gt;&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>IN Angular typescript:</p>
  
  <pre><code>callMyCount(){    
    document.getElementById('timer').innerHTML ="02" + ":" + "00";
    var myTimer=setInterval(startTimer,1000);
  
    function startTimer() {
      var presentTime = document.getElementById('timer').innerHTML;
      var timeArray = presentTime.split(/[:]+/);
      var m = parseInt(timeArray[0]);
      var s = checkSecond((parseInt(timeArray[1]) - 1));
      if(s==59){m=m-1}
      if(m&lt;0 &amp;&amp; s==59){alert("Timeout for otp");
                       clearTimeout(myTimer);}
      document.('timer').innerHTML =  m + ":" + s;
    }
  
    function checkSecond(sec) {
      if (sec &lt; 10 &amp;&amp; sec &gt;= 0) {sec = "0" + sec}; 
      if (sec &lt; 0) {sec = "59"};
      return sec;
    }
  }
  </code></pre>