2017-03-05 144 views
0

我要翻译一个字符串,用AngularJs过滤器,在这里,我要把我的代码:翻译字符串变量

item={ "_id": "58b9ee5fd7835400059c11f7", "privilegeParent": "58b9ec296aca0e2020257c4a", "create": { "at": "2017-03-05T01:34:28.273Z" }, "notifications": { "web": { "active": false }, "mail": { "active": false }, "sms": { "active": false }, "parameters": [] }, "name": { "code": "systemStatus", "en": "System Status" } } 

而且这里的html代码:

,并在这里所需的字符串“update_screen “:”{{x}}的更新屏幕“

回答

1

如果您使用lodash,则可以在您的过滤功能中执行此操作:

function myFilter() { 
    return function(str, obj) { 
     return _.join(['Update screen of ', _.get(str, obj.x)]); 
    } 
} 

如果你不使用任何工具库,请提供多一点的信息

希望帮助!

+0

感谢您的有趣... –