directive ngBindTemplate

  ngBindTemplate指令指定元素文本内容应该替换为在ngBindTemplate属性中的模板的内插。与ngBind不同,ngBindTemplate可以包含多个表达式。由于一些HTML元素(如Title和Option)不能包含SPAN元素,所以需要这个指令。

用法:

作为标签元素

<ng-bind-template
  ng-bind-template="string">
...
</ng-bind-template>

作为属性

<ANY
  ng-bind-template="string">
...
</ANY>
<!DOCTYPE html>
<html ng-app="bindExample">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="framework/angular.js"></script>
</head>
<body>
<script>
    angular.module('bindExample', [])
            .controller('ExampleController', ['$scope', function($scope) {
                $scope.salutation = 'Hello';
                $scope.name = 'World';
            }]);
</script>
<div ng-controller="ExampleController">
    <label>Salutation: <input type="text" ng-model="salutation"></label><br>
    <label>Name: <input type="text" ng-model="name"></label><br>
    <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
</div>
</body>
</html>
原文地址:https://www.cnblogs.com/ms-grf/p/7000092.html