How to create Undo and Redo value functionality from input tag in Angular?

I want to create a functionality which undo and redo value from input tag in angular. What I supposed to do is as follows if I enter Hello in input:

  1. click undo button: show hell
  2. click undo button: show hel
  3. click redo button: show hell
  4. click redo button: show hello

Please help. Thanks