VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-ng-bind-directive/

⇱ AngularJS ng-bind Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS ng-bind Directive

Last Updated : 1 Aug, 2022

The ng-bind Directive in AngularJS is used to bind/replace the text content of any particular HTML element with the value that is entered in the given expression. The value of specified HTML content updates whenever the value of the expression changes in the ng-bind directive.

Syntax:

<element ng-bind="expression"> 
 Contents... 
</element>

Parameter value:

  • expression: It is used to specify the expression to be evaluated or the variable.

Example 1: This example implements the ng-bind Directive to bind the product of two numbers to the <span> element. 

Output:

👁 Image
 

Example 2: This example implements the ng-bind Directive to bind the innerHTML of the <span> element to the variable text. 

Output:

👁 ng-bind

Comment

Explore