我无法从json加载转换值。它返回json键 [英] I can't load the translation value from json. It returns me the json key
本文介绍了我无法从json加载转换值。它返回json键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在导航菜单中翻译标题,但标题是在html中自定义的。以下是代码:
var string ='13';
$ scope.string123 = $ filter('translate')(string);
var test =< p style ='line-height:15px!important'> {{string123}}< / br> klient / artikull< / p>;
msNavigationService.saveItem('apps.offers.priceperunitnew',{
title:$ interpolate(test)($ scope),
icon:'icon-barcode',
state :'app.offers.priceperunitnew',
隐藏:function(){
var priceforunitnew = true;
if(localStorage.getItem(OfertaCmimNjesiNew)==='1')
{priceforunitnew = false;}
else {priceforunitnew = true;}
return priceforunitnew;
},
weight:8
});
因此字符串是JSON中的键值,test是自定义标题。我只是想用i18n翻译标题,但它会给我钥匙,在这种情况下是13
我尝试了什么:
我试图在控制器中进行插值但仍无法正常工作
解决方案
scope.string123 =
过滤器( '翻译')(字符串);
var test =< p style ='line-height:15px!important'> {{string123}}< / br> klient / artikull< / p>;
msNavigationService.saveItem('apps.offers.priceperunitnew',{
title:
interpolate(test)(
I want to translate the title in navigation menu, but the title is customized in html. Here is the code:
var string = '13'; $scope.string123 = $filter('translate')(string); var test = "<p style='line-height:15px!important'>{{string123}}</br>klient/artikull</p>"; msNavigationService.saveItem('apps.offers.priceperunitnew', { title: $interpolate(test)($scope), icon: 'icon-barcode', state: 'app.offers.priceperunitnew', hidden: function () { var priceforunitnew = true; if (localStorage.getItem("OfertaCmimNjesiNew") === '1') { priceforunitnew = false; } else { priceforunitnew = true; } return priceforunitnew; }, weight: 8 });
So string is the key value in JSON and test is the customizet title. I just want to translate the title with i18n but it returns me the key, in this case 13
What I have tried:
I tried to interpolate in controller but still does not work
解决方案
scope.string123 =
filter('translate')(string); var test = "<p style='line-height:15px!important'>{{string123}}</br>klient/artikull</p>"; msNavigationService.saveItem('apps.offers.priceperunitnew', { title:
interpolate(test)(
这篇关于我无法从json加载转换值。它返回json键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文