AngularJS ng-bind-template command
AngularJS examples
Binding on the <p> element two expressions:
<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>
<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 command is used to tell AngularJS given value of the expression to replace the contents of an HTML element.
When you want to bind multiple expressions on the HTML element can be used whenng-bind-template command.
grammar
<Element ng-bind-template = "expression"> </ element>
All HTML elements support the instruction.
Parameter Value
value | description |
---|---|
expression | One or more expressions to be performed, each using {{}} contains. |