Answer the question
In order to leave comments, you need to log in
How not to update the value of an input on user input?
There are projects on vue.js, in some of them not everything goes smoothly with databinding.
It's good when it is unidirectional - from the input fields, the data is transferred to the state and then spread throughout the application.
But there are a number of cases when it is more convenient to use two-way data binding - that is, data can be transferred both from input fields and received back into them (for example, a validator works, initialization of fields with initial values, or something similar). In such situations, it is important not to update the data in the input field when the user is engaged in it, otherwise his rage is guaranteed.
Maybe someone knows if there is any standard feature in angular or vue to block field updates on user input into them? Of course, I will write my own, but lazily.
Answer the question
In order to leave comments, you need to log in
In OpenLecture video #2017.1 - Let's Vue! found the answer - modifiers are used for this. The modifier is suitable for my question .lazy
.
<!-- synced after "change" instead of "input" -->
<input v-model.lazy="msg" >
In angular, you can put in ng-model-options, for example, an update only with blur. Well, use parsers / formatters for validators and other things.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question