Search code examples
javascriptangularjsemailinternationalizationmailto

email address in Angular i18n string


I'm adding a internationalized message to the footer of an AngularJS page, including an email address - For additional help, please send an email to help@email.com This is added to the relevant js i18n files as

"helpnote": "For additional help, please send an email to mailto:help@email.com"
"helpnote": "Para obtener ayuda adicional, por favor envíe un correo electrónico a mailto:help@email.com"
"helpnote": "Pour une aide supplémentaire, se il vous plaît envoyez un courriel à mailto:help@email.com"

etc

unfortunately the mailto link appears as text if I use

 <div class="helpnote">{{i18n.helpnote}}</div>

i.e. this exact string appears on screen - "For additional help, please send an email to mailto:help@email.com"

Can the internationalized string be written, or bound to the div, in such a way that the link becomes active?


Solution

  • Use either ng-click on the div to make it avtive somehow and do the redirection in the controller using $location perhaps ( if there is more magic behind your action ) or simply create regular link with ng-href.

    https://docs.angularjs.org/api/ng/directive/ngHref