AngularJS ng-value directive

Definition and Usage

ng-value Set the input element or the selected element's instruction value Properties.

Example

Set the value of the input field:

<div ng-app="myApp" ng-controller="myCtrl">
<input ng-value="myVar">
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
    $scope.myVar = "Hello World!";
});
</script>

Try It Yourself

Syntax

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

Affected <input> and <select> Element Support.

Parameters

Parameters Description
expression The expression of the value attribute of the setting element.