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

AngularJS ng-bind Directive

AngularJS ng-bind Instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS Examples

Bind

the innerHTML of to the variable myText:

<

div

ng-app=

""

ng-init=

"myText='Hello World!'"

<

p

ng-bind=

"myText"

<

/p

<

/div

Try it »


Definition and Usage

ng-bind The directive tells AngularJS to replace the content of the HTML element with the value of the given variable or expression.

If the given variable or expression is modified, the specified HTML element will also be modified.


Syntax

<

element

ng-bind=

"expression"

<

/element

Or as a CSS class:

<

element

class=

"ng-bind: expression"

<

/element

All HTML elements support this directive.


Parameter value

Value Description
expression Specifies the variable or expression to execute.

AngularJS Reference Manual AngularJS Reference Manual