zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    L3-007. 天梯地图
    智能算法-遗传算法
    L2-012. 关于堆的判断
    L2-010. 排座位
    计算几何初步-三点顺序
    L3-001. 凑零钱
    靠二进制画几何[图论]
    【排序】
    欧拉路与欧拉回路
    Test on 2016/09/26
  • 原文地址:https://www.cnblogs.com/ms-grf/p/7000092.html
Copyright © 2011-2022 走看看