简体   繁体   中英

get old value and new value in input text using Angular 2+

i am trying to get the old value and the new value in input text after focus. I cant seem to find a way to get the data from the input only without focus. it gets the data each time i add a letter in the input and instead of getting the text when out of focus. thanks

Since you want to trigger your logic on blur event, add methods for corresponding events ( focus -for storing initial value, blur -showing final value) and perform logic.

Stackblitz : https://stackblitz.com/edit/angular-reactive-forms-gnwg9p

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM