I am trying to implement a multilingual text input field with a small drop down button on the left to select a language. For example, when the drop-down menu shows "de", the text field should be bound to model.multilingualData['de'].someField, etc.
My first approach was to install ngModel in model.multilingualData[selectedLanguage].someField. But when the user selects another language without filling in the field correctly, an error is not set in the form, since now the model points to another object.
My next idea was to create a whole element directive without ngModel, but then I could not do other checks like ngMaxLength.
I could not find anything useful on the Internet. Any idea on how to implement this correctly?
EDIT
Here is a small fiddle that illustrates the problem: http://jsfiddle.net/FZ2kg/
Not only does the form appear when switching languages, the previous field value is also deleted, since the model is set to nullwhen the field becomes invalid.
source
share