I've been grappling with this issue for quite some time now without much success.
My goal: I'm attempting to store the value of an angular translation (using $translate) in a global variable so that I can later use it for assigning dynamic variable values. These translations are stored in a json file and configured within angular.module(..).config(..)
This is what my js file looks like:
angular.module('myApp').controller('MyCtrl',
function ($translate, $scope) {
var temp_text='';
$translate(['Text1']).then(function (translations) {
temp_text=translations.Text1;
alert(temp_text);
});
alert(temp_text);
});
The issue here is that the temp_text value appears as empty in the first popup, but correct in the second one.
Any ideas on how I can retain the translated value in a global variable for future reference?