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

AngularJS ng-bind-template Directive

AngularJS ng-bind-template Instruction

AngularJS Reference Manual AngularJS Reference Manual


AngularJS Examples

Bind two expressions on the element:

<

div

ng-app=

"myApp"

ng-bind-template=

"{{firstName}} {{lastName}}"

ng-controller=

"myCtrl"

<

/div

<

script

var app = angular.module("myApp", []);

app.controller("myCtrl", function($scope) {

    $scope.firstName = "John";

    $scope.lastName = "Doe";

});

<

/script

Try it »


Definition and Usage

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

When you want to bind multiple expressions on an HTML element, you can use ng-bind-template directives.


Syntax

<

element

ng-bind-template=

"expression"

<

/element

All HTML elements support this directive.


Parameter value

Value Description
expression One or more expressions to execute, each enclosed in {{ }}.

AngularJS Reference Manual AngularJS Reference Manual