I have a generic JSON structure like this
{
"parameters":
[
{
"key":"fieldName","posibleValues":["Val1,"Val2"],
"key":"anotherField","posibleValues":["ValA,"ValB"]
}
]
}
No I want to do something like this:
<div ng-repeat="parameter in parameters">
<ng-form name="paramForm">
{{parameter.key}}: <select ng-model="request.parameter.{parameter.key}" ng-option="..." />
</ng-form>
</div>
The problems comes with the
select ng-model="request.parameter.{parameter.key}"
So I want to setup a model that is named like "request.parameter.fieldName" (according to the "key" in the JSON structure.
Is this possible? Or do I have to help myself with a ng-change?
Thanks
asked Feb 6, 2013 at 12:19
Soccertrash
1,9013 gold badges30 silver badges49 bronze badges
-
Ok, just found out myself: stackoverflow.com/questions/12553617/…Soccertrash– Soccertrash2013年02月06日 12:22:33 +00:00Commented Feb 6, 2013 at 12:22
1 Answer 1
If someone is looking for anything in this way, you can use the following syntax:
request.parameter[parameter.key]
Jonatas Walker
14.3k6 gold badges57 silver badges82 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default