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="/libs//1.4.6/"></script> </head> <body> <div ng-app="myApp" ng-bind-template="{{firstName}} {{lastName}}" ng-controller="myCtrl"> </div> <script> var app = ("myApp", []); ("myCtrl", function($scope) { $ = "John"; $ = "Doe"; }); </script> </body> </html>
Running results:
John Doe
Definition and usage
ng-bind-template Directives are used to tell AngularJS to replace the contents of HTML elements 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.