विश्व का सबसे बड़ा हिंदी वेब डेवलपर साइट

AngularJS ng-value Directive


Set the value of the input field:

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

<input ng-value="myVar">


var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
    $scope.myVar = "Hello World!";
Try it yourself »

Definition and Usage

The ng-value directive sets the value attribute of a input element, or a select element.


<input ng-value="expression"></input>

Supported by <input> and <select> elements.

Parameter Values

Value Description
expression An expression that will set the element's value attribute.