Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

AngularJS ng-value Directive

AngularJS ng-value Instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS Examples

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 »


Definition and Usage

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


Syntax

<

input

ng-value=

"expression"

<

/input

and