Ng-Value-4

 

In this example true and false with ng-value bind to the bool variable and display along with AAA. Similarly Yes and No for BBB bind with Bool variable and selected value display with BBB.

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app> <h3>Which is your favorite ?</h3> <div> <table> <tr> <td>AAA:<b>{{bool}}</b></td> <td>True:<input type="radio" name="bool" ng-value="true" ng-model="bool" /></td> <td>False:<input type="radio" name="bool" ng-value="false" ng-model="bool" /></td> </tr> <tr> <td>BBB:<b>{{Bool}}</b></td> <td>Yes:<input type="radio" name="course1" ng-value="'Yes'" ng-model="Bool" /></td> <td> No:<input type="radio" name="course1" ng-value="'No'" ng-model="Bool" /></td> </tr> </table> </div> </body> </html>
Output