title: How to get the previous value in (input) event in angular 4
body: <p>I am trying to add the value and also need to remove the previous value by comparing with a new value.</p>
  
  <pre><code> var  total = [];
   onSearchChange(event) {
      total.push(event);
      var sumNumber = total.reduce(
        (acc, cur) =&gt; acc + Number(cur),
        0
      );
      console.log("get all the changed value, I need to remove the previous values in the total list");
    }
  </code></pre>
  
  <pre class="lang-html prettyprint-override"><code> &lt;input type='number' (input)="onSearchChange($event.target.value)" /&gt;
  </code></pre>