9

I have such directive:

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

(as you can see also i'm using translate plugin)

and there i have a problem: in scope this value is changing, but it doesn't change in directive(

when i'm using attrs-params (sure, if customDynamicText is a static string - all works) - but i have a dynamic variable customDynamicText

How can i use this dynamic variable in directive template with ng-bind-html.

Is it possible?

2

1 Answer 1

3

Simply clever... I forgot to remove some quote-chars... So works:

...
<p ng-bind-html="' + attrs.customDynamicText + ' | translate"></p>\
...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.