也许这是一个好主意,单独的视图和数据我已经提取的属性
function() {
angular.module("testerMod").provider("language", function() {
"ngInject";
this.path = "/assets/locale/", this.userLanguage = "en", this.$get = function(e) {
return ["$http", "$state", "$log", "$cookies", function(t, n, i, o) {
return function(a, s) {
var r, l, c;
return l = _.find(s.locales, {
code: a
}), null == l ? (r = _.find(s.locales, {
code: o["language"]
}), null != r ? a = r.code : (c = _.find(s.locales, {
code: e.userLanguage
}), a = null != c ? c.code : _.find(s.locales, {
"default": !0
}).code), void n.go("home", {
language: a
})) : t({
method: "GET",
url: e.path + a + ".json"
}).then(function(e) {
return e.data
}, function(e) {
return i.error("Language Load Error")
})
}
}]
}(this)
})
}
:链接源,链接文本,这样的Json只会意味着传输数据和浏览器或应用程序将根据您的应用程序逻辑渲染视图。
{
"test":{
"description": "A little test ",
"link_source":"https://www.google.com",
"link_text":"Visit Google"
}
}
为您的版本工作,如果你想https://jsonformatter.curiousconcept.com/ 也有另一篇文章在这里关于JSON序列化可以在此处检查您的JSON的有效性http://www.popoloproject.com/appendices/json-patterns.html
你需要证明什么是消费/使用此JSON或我们不能猜测为什么这不起作用...... JSON本身是数据,而不是代码。 –
你是指我如何加载它或哪个库正在使用这些数据? –
其中之一或两者 - 无代码的JSON只是文本,所以直到我们看到涉及的代码时,不可能猜测可能发生了什么。 –