AngularJS 指令:具有范围值的模板 (ng-bind-html)

AngularJS directive: template with scope value (ng-bind-html)

我有这样的指令:

...
template: function(element, attrs) {
    var htmlTemplate = '<div class="start-it" ng-if="isVisible">\
          <p ng-bind-html="\'{{customDynamicText}}\' | translate"></p>\
        </div>';
    return htmlTemplate;
},
...

(你也可以看到我正在使用翻译插件)

我有一个问题:在范围内这个值正在改变,但它在指令中没有改变(

当我使用 attrs-params 时(当然,如果 customDynamicText 是静态字符串 - 一切正常) - 但我有一个动态变量 customDynamicText

如何在 directive templateng-bind-html 中使用这个动态变量。

可能吗?

简直聪明... 我忘了删除一些引号字符... 所以有效:

...
<p ng-bind-html="' + attrs.customDynamicText + ' | translate"></p>\
...