1

i am trying to get a value of the selected radio button but it is not working.

This is my code:

<input class="star star-5" id="star-5" type="radio" name="star1" ng-model="star" ng-value="'5'"/>

<label class="star star-5" for="star-5"></label>

<input class="star star-4" id="star-4" type="radio" name="star1" ng-model="star" ng-value="'4'"/>

<label class="star star-4" for="star-4"></label>

<input class="star star-3" id="star-3" type="radio" name="star1" ng-model="star" ng-value="'3'"/>

<label class="star star-3" for="star-3"></label>

<input class="star star-2" id="star-2" type="radio" name="star1" ng-model="star" ng-value="'2'"/>

<label class="star star-2" for="star-2"></label>

<input class="star star-1" id="star-1" type="radio" name="star1" ng-model="star" ng-value="'1'"/>

<label class="star star-1" for="star-1"></label>
<div>{{start}}</div>

Could you guys please help me out?I am not checking where the error is. Thank you

Sarah
  • 13
  • 4
  • 1
    Possible duplicate of [How can I get the value of the checked radio button when submitting a form using angularjs?](https://stackoverflow.com/questions/15166270/how-can-i-get-the-value-of-the-checked-radio-button-when-submitting-a-form-using) – prasanth Jul 12 '17 at 10:49
  • 1
    It should be star
    {{star}}
    – Vivz Jul 12 '17 at 10:49
  • 1
    Possible duplicate of [How to get value of selected radio button in angularjs](https://stackoverflow.com/questions/32450288/how-to-get-value-of-selected-radio-button-in-angularjs) – Vivz Jul 12 '17 at 11:41

3 Answers3

0

The correct syntax is as below

 <input class="star star-3" type="radio" name="response" data-ng-model="star" data-ng-value="true"  />
0

Its typo start remove t in these code

<div>{{star}}</div> Fiddle

Arunkumar G
  • 126
  • 6
0

Here is the correct code

<div>{{star}}</div>

And here is the plunk: https://plnkr.co/edit/JAbsgMOoagjn535fh8qE?p=preview

Manishz90
  • 2,534
  • 1
  • 12
  • 11