Reputation: 151
Recently I migrated all the strings in my app to angular-translate. My original strings use components to do some replacements, like this:
Resource: <get-html value="'dark_matter'"></get-html>
I noticed that when I put those through the angular-translate filter, the component doesn't get called.
I configured the sanitation strategy to sanitize
$translateProvider.useSanitizeValueStrategy('sanitize');
And I'm using the filter like this
<p>{{ 'DESCRIPTION' | translate }}</p>
The implementation of get-html is the following
<span ng-bind-html="ct.util.trustHTML(ct.util.getHTML(ct.value))"></span>
The result is the string without the component replacement.
I would like if it is possible to call a custom component inside a string, or if I'm approaching this from a completely wrong angle.
Upvotes: 0
Views: 31
Reputation: 1319
If you can modify the getHTML(..) method, you could inject $translate, and do the translation inside the method as so:
$translate.instant(value)
Upvotes: 0