AngularJS - save radion buttons information

0

I have a table that runs through a JSON with questions

<tr ng-repeat="pregunta in preguntas" ng-if="pregunta.tipo.id === 3" class="table-pointer" >
    <td>{{pregunta.pregunta.nombre}} ({{pregunta.pregunta.porcentaje}}%)</td>
        <td><input class="form-check-input" type="radio" name="{{pregunta.id}}" ng-value="pregunta.pregunta.porcentaje"></td>
        <td><input class="form-check-input" type="radio" name="{{pregunta.id}}" value="0"></td>
</tr>

In which I bring the questions of a certain type and I show the name of that question and the percentage that it adds (the percentage is the one that I return as value).

What I have no idea how to do is to be able to store that information within my scope.

With my other objects (select, text, textarea) with put ng-model="informe.xxxx" (being my variable scope variable) it reached but with the radio buttons I can not do it.

Please note:

  • They are loaded dynamically: Today I have 3 sections with 17 questions in total, the idea is that if tomorrow add 20 questions to a section that does not affect the code.
  • I need to be able to save both the id of the question and the value

If you need more information, let me know!

Thank you very much!

    
asked by JuanManuel245 05.10.2018 в 16:38
source

0 answers