Search code examples
angularjsangular-translateangular-i18n

Angular-Translate UrlLoader


I am having an issue about angular-translate useurlloader.My config is on angular side ;

$translateProvider.useUrlLoader(ALL_CONSTANTS.AdminApiEndPointPrefix + "UtilitiesAPI/getResources");

  $translateProvider.preferredLanguage('en');

And my web api side is;

 public async Task<string> GetAllResourceTexts(string culture)
    {

        var ret =  "{'key' : 'value'}";
        return JsonConvert.SerializeObject(ret);
    }

But i cant see the translation on my view ;

<p>{{'key' | translate}}</p>

What should i do ? How should i return that key value pair from web api ? Need help.

PS: I solved. The problem was returning JSON format from api. When i fix that my problem is solved..


Solution

  • I solved. The problem was returning JSON format from api. When i fix that my problem is solved..