Skip to content
Related Articles

Related Articles

AngularJS | ng-value Directive

View Discussion
Improve Article
Save Article
  • Last Updated : 05 Apr, 2019

The ng-value Directive in AngularJS is used to specify the value of an input element. It is supported by <input> and <select> elements.


<element ng-value="expression"> Content ... </element> 

Example 1:

<!DOCTYPE html>
        <title>ng-value Directive</title>
        <script src=
    <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}}
          <pre>Selected choice is: {{my.fav}}</pre>
      var app = angular.module("app", []);
      app.controller('geek', ['$scope', function ($scope) {
          $scope.sort = ['Merge Sort', 'Quick Sort', 'Bubble Sort'];
          $ = { fav: 'Merge Sort' };


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!