Issue
It is possible to subscribe a callback to an NgForm
's valueChanges
observable property in order to react to changes in the values of the controls of the form.
I need, in the same fashion, to react to the event of the user touching one of the form controls.
This class seem to define the valueChanges
Observable and the touched
property is defined as a boolean.
Is there a way to to react to the "control touched" event?
Solution
There is not direct way provided by ng2 to react on touched event. It uses (input) event to fire the valueChanges event and (blur) event to set touched/untouched property of AbstractControl. So you need to manually subscribe on desired event in the template and handle it in your component class.
Answered By - Valikhan Akhmedov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.