Answer the question
In order to leave comments, you need to log in
How to dynamically change the content of a field in AngularJS depending on the criteria of another?
Good afternoon,
there is a view in which the fields are:
1. drop-down list with positions (rubles; thousand rubles; million rubles)
2. many fields in which the price is indicated.
It is necessary to store the price in rubles in the model object, and display the value with the currency type condition as a multiplier in the price field.
Those. when changing the type of currency (for example, from rubles to thousand rubles), change the presentation of prices in all fields of the view and, in the same way, perform the opposite action if you change the price (s) (already in thousands, if this type of currency is selected) in field with a price, then the price in rubles would fall into the object.
What have you been doing:
1. the currency type field was screwed with the ng-change handler (function), and the fields with prices ng-model with a unique variable (the price value changes, but I would not want to do without ng-model, because there are a lot of fields and to a greater extent this dynamics). And the directive for the field with the price, which I track changes in the price field and perform the function with the reverse conversion to rubles, with subsequent transfer to the object, BUT this directive is called before the value in the field changes (i.e. with a delay)
2. to display the price , in value inserted the converted value using a filter, but how to perform the reverse conversion.
Can you please tell me how this thing can be done?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question