AngularJS ng-bind-template Directive

Definition and Usage

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

Use this directive when you want to bind multiple expressions to an HTML element: ng-bind-template Directive.

Example

Bind two expressions to a <p> 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 = "Bill";
    $scope.lastName = "Gates";
});
</script>

Try It Yourself

Syntax

<element ng-bind-template="expression</element>

All HTML elements support.

Parameter

Parameter Description
expression To calculate one or more expressions, each expression is enclosed in {{ }}.