AngularJS | ng-value Directive
The ng-value Directive in AngularJS is used to specify the value of an input element. It is supported by <input> and <select> elements.
Syntax:
<element ng-value="expression"> Content ... </element>
Example 1:
<!DOCTYPE html> <html> <head> <title>ng-value Directive</title> <script src= </script> </head> <body ng-app="app" style="padding:20px"> <h1 style="color:green;">GeeksforGeeks</h1> <h2 style="">ng-value Directive</h2> <p>Choose one:</p> <div ng-controller="geek"> <div ng-repeat="l in sort"> <input type="radio" ng-model="my.fav" ng-value="l" name="Sort"> {{l}} </div> <pre>Selected choice is: {{my.fav}}</pre> </div> <script> var app = angular.module("app", []); app.controller('geek', ['$scope', function ($scope) { $scope.sort = ['Merge Sort', 'Quick Sort', 'Bubble Sort']; $scope.my = { fav: 'Merge Sort' }; }]); </script> </body> </html> |
chevron_right
filter_none
Output:

Recommended Posts:
- AngularJS | ng-app Directive
- AngularJS | ng-if Directive
- AngularJS | ng-jq Directive
- AngularJS | ng-src Directive
- AngularJS | ng-cut Directive
- AngularJS | ng-csp Directive
- AngularJS | Directive
- AngularJS | ng-selected Directive
- AngularJS | ng-required Directive
- AngularJS | ng-paste Directive
- AngularJS | ng-srcset Directive
- AngularJS | ng-readonly Directive
- AngularJS | ng-blur Directive
- AngularJS | ng-bind Directive
- AngularJS | textarea Directive
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

