EDIT: My code really works, I was just an idiot with an unrelated problem. Thanks for your input.
So, I have an array of JSON objects formatted as follows:
[{"id":"id1", "text":"text1"}, {"id":"id2", "text":"text2"},....]
I want to populate the AngularJS select box using them, with text fields as display text and id fields as values or any other model-related. I looked around, but could not let my life determine what I needed to do.
Now I have this for my choice, as a result of which nothing is displayed:
<select name="field" ng-model="npe.formData.field" ng-options="field.id as field.text for field in fields">
Executing ng-parameters in this way leads to the display of things, but, obviously, will lead to binding the wrong value to the model:
ng-options="field as field.text for field in fields"
I saw people talking about using "(key, value)", but I can’t plunge into how it works.
source
share