Using the ng-value
attribute is appropriate when you need to assign a variable defined in the scope
. If you want to set static data, the value
attribute of the input
element can be utilized, as shown below:
<input type="radio" name="grupoRadio" value="1" ng-model="valor" > Certificado de cobertura sin nómina de personal
<br>
<input type="radio" name="grupoRadio" value='CNC' ng-model="valor" > Certificado de cobertura con nómina de personal completa
<br>
<input type="radio" name="grupoRadio" value="CNP" ng-model="valor"> Certificado de cobertura con nómina de personal parcial
If you have variables that need to be bound, you can utilize the following approach:
$scope.data = [{
{text: 'Certificado de cobertura sin nómina de personal', value: '1'},
{text: 'Certificado de cobertura con nómina de personal completa', value: 'CNC'},
{text: 'Certificado de cobertura con nómina de personal parcial', value: 'CNP'}
]
<span ng-repeat="item in data">
<input type="radio" name="grupoRadio" ng-value="item.value" ng-model="valor" > {{item.text}}
</span>