srv
srv

Reputation: 440

Angular Translation in JavaScript File

I have followed the Angular translation example and html page translation is working by calling with filter, say {{'TITLE' | xlat}}

I want to use the translation in JavaScript file. I tried calling $scope.xlat(), $xlat() or xlat().

How to refer and do the translation in JS file?

Upvotes: 0

Views: 558

Answers (1)

Michał Sałaciński
Michał Sałaciński

Reputation: 2266

It should be probably:

$filter('xlat')('TITLE')

Also, remember that '$filter' must be injected.

Upvotes: 1

Related Questions