Tutorialsplane

AngularJs get radio button value


AngularJs get radio button value – While using the html form input elements we sometimes need radio button or even sometimes we need user to select the one option from the radio button. It is very simple to get the select radio button value in angularjs. Here in this tutorial we are going to explain how you can get the selected radio button value. You can also use our online editor to edit and run the code online.


AngularJs get radio button value

Let us go step by step-

JavaScript Part

JavaScript Part Contains the following part as below –

AngularJs get radio button value in controller:


Html Part

Html Part contains the following html as below –

AngularJs get radio button value in View:

<div ng-app="myApp">  
<div ng-controller="myController">  

 <p>Selected Gender = {{selectedGender}}</p>
 
</div> 
</div>

Complete Part

Now let us combine both html and JavaScript parts –

AngularJs get selected radio button value Example:




 
 

  
<div ng-app="myApp">  
<div ng-controller="myController">  

 <p>Selected Gender = {{selectedGender}}</p>
 
</div> 
</div>
  
      

Try it »

If you run the above example it will produce output something like this –