angularjs - Directive inside a angular-translate translation -
i'm using angular-translate i18n , want use directive inside translation:
var translations = { test_1: 'hello <a href="/test">test</a>', test_2: 'hello <user></user>' }; app.directive('user', function() { return { template: '<a href="/test">test</a>' }; });
full plnkr example: http://plnkr.co/edit/jcccvx7ieaayuwyaq7uh?p=preview
so
<p translate="test_1"></p> <p translate="test_2"></p>
should same. first (without directive) works, second doesn't. transcludes <user></user>
, angular doesn't seem aware of , doesn't directive magic.
try use translate-compile
directive:
<p translate="test_2" translate-compile></p>
from docs:
starting version 2, translation can post processed in context of current scope (using $compile). means directive used in translation value work expected.
Comments
Post a Comment