AngularJS ng-bind-template directive
AngularJS instance
<p> Two expressions are bound to the element:
<!DOCTYPE html><html><head><meta charset="utf-8"><script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body><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></body></html>Running results:
John Doe
Definition and usage
The ng-bind-template directive tells AngularJS to replace the contents of an HTML element with the value of a given expression.
You can use the ng-bind-template directive when you want to bind multiple expressions on HTML elements.
grammar
<element ng-bind-template="expression"></element>
All HTML elements support this directive.
Parameter value
| value | describe |
|---|---|
| Expression | One or more expressions to be executed, each containing using {{ }}. |
The above is an introduction to the AngularJS ng-bind-template instruction knowledge. Friends who need it will take a look.