Easy Tutorial
❮ Ng Ng Model Ng Ng Mousedown ❯

AngularJS ng-value Directive

AngularJS Reference Manual


AngularJS Example

Set the value of an 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>

Definition and Usage

The ng-value directive is used to set the value attribute of an input or select element.


Syntax

The attribute is supported by <input> and <select> elements.


Parameter Values

Value Description
expression The expression used to set the value of the attribute.

AngularJS Reference Manual

❮ Ng Ng Model Ng Ng Mousedown ❯