1

Hi Am trying to achieve an html where when you click a radio button, I want to update my Obj.

so when I click save button I will send my Obj to api to save the data.

My problem is I am lost on how to make a radio button that will update my obj?

is this posible.?

 scope.Obj =   [
      {
        "condition": "Question1",
        "status": ""
      },
      {
        "condition": "Question2",
        "status": ""
      },
      {
        "condition": "Question3",
        "status": ""
      }
     ]

HTML OUTPUT

Question                                    Status (Radio Button)

Question1                                      yes[]    no[]
Question2                                      yes[]    no[]
Question3                                      yes[]    no[]

                                                 [ Save ]
1

1 Answer 1

3

If you just display your object you will see that it is bound to the values.

<div ng-repeat="o in obj">
      Yes <input type="radio" ng-model="o.status" value="yes" />
      No <input type="radio" ng-model="o.status" value="no"  /> 
...

{{obj}}

Here's a fiddle

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.