3

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

1

1 Answer 1

4

If someone is looking for anything in this way, you can use the following syntax:

request.parameter[parameter.key]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.