English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
<p> Bind two expressions on the <p> element:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/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>Test see ‹/›
ng-bind-template This directive is used to tell AngularJS to replace the content of the HTML element with the value of the given expression.
You can use this directive when you want to bind multiple expressions to an HTML element. ng-bind-template Directives.
<element ng-bind-template="expression"></element>
All HTML elements support this directive.
Value | Description |
---|---|
expression | One or more expressions to be executed, each enclosed in {{ }}. |