javascriptangularjsangular-uiangular-translate

AngularJS translate & ui tooltip html


I have such view:

uib-tooltip-html="tooltipData(form, field)"

and tooltipData returns data (example):

***
var str = $translate.instant('LONG_EMAIL')
return str;
***

and when i switch lang of my app - translation isn't updating((

when i hardcode (it's a bad way of solving this issue)

uib-tooltip-html="{{'LONG_EMAIL' | translate}}"

all is fine

How can i translate my string returned from the controller?


Solution

  • You could achieve this by having $filter over translate

    var str = $filter('translate')('LONG_EMAIL')
    return str;