需要使用ng-bind的等效语法

时间:2015-05-12 11:53:18

标签: angularjs angularjs-directive angularjs-scope ng-bind

如何在以下代码中将{{eachTab.tabName}}替换为ng-bind

<tabset>
    <tab ng-repeat="eachTab in rowTabs" heading="{{eachTab.tabName}}"
         select="createRecsforeachTab(dSet, eachTab)">
    </tab>
</tabset>

2 个答案:

答案 0 :(得分:0)

尝试将ng-repeat移动到tabset范围内,如下所示:

<tabset ng-repeat="eachTab in rowTabs">
    <tab heading="{{eachTab.tabName}}" ng-bind-html="{{eachTab.tabName}}" select="createRecsforeachTab(dSet, eachTab)"> </tab>
</tabset>

答案 1 :(得分:0)

你已经回答了! ngBind

以下代码来自@ post @badsyntax

angular.module("template/tabs/tab.html").run(["$templateCache", function($templateCache) {
  $templateCache.put("template/tabs/tab.html",
    "<li ng-class=\"{active: active, disabled: disabled}\">\n" +
    "  <a ng-click=\"select()\" tab-heading-transclude ng-bind-html=\"heading\"></a>\n" +
    "</li>\n" +
    "");
}]);