I bound a variable to an input filed using interpolation (value of variable gets reflected in the input field). The variable gets updated automatically in the background whenever the according value in the database changes.
I would like to prevent Angular from applying the changes of the variable to the input field IF the user is currently editing this field. Otherwise, the editing of the user will be overwritten.
(In other words: I would like that Angular checks if the input field is currently flagged with ng-pristine and not ng-dirty before it updates the value.)
What is the easiest why to achieve that?
Idea: Shouldn't it be possible to implement a directive that is equal to ngModel but checks if the class ng-dirty is set before applying the value?
Optimal Solution: Having a directive, that does two-way-data-binding like ngModel. The directive applies changes within the model to the view if the "ng-dirty" flag is not set for the view. The directive applies changes within the view to the model if the view loses its focus (if the blur event gets triggered).

