Reputation: 1640
im currently using Angular implementation of the
I want to pass to the title an Angular directive with translate
This is the variable I'm passing as title
{{ 'register.confirmation_modal.SUPERIOR_MESSAGE' | translate }}
And using Angular Compile Service
var translate_title = "<span>{{ 'sa.title' | translate }}</span>";
var compiled_title = $compile(translate_title)($scope);
and using html: true,
in Sweet alert options
But i'm getting an object and it's being printed like the follow image
I tried using .innerHTML but it removes the Tags and gets the literal string with the curly braces {{ }}
JSON.stringify didn't worked either.
Any advice?
Upvotes: 0
Views: 1494
Reputation: 1640
Credits to @Claies for pointing me to the solution
Instead of using $compile
I solved my issue using the Filter translate from Angular translate
This did the trick:
var n = $filter('translate')('sa.title');
Regards.
Upvotes: 1