Angularjs JSON NG重复问题 [英] Angularjs JSON NG-repeat problem
问题描述
嗨大家。
我需要你的帮助。
我想循环一个json文件angularjs。
到目前为止一切都很好。
没问题。
但现在我有问题:)
我尝试了什么:
http调用是:< br $>
$ http({
方法:'GET',
url:'url'
})
.then(function successCallback(response){
$ scope.UserObject = response.data;
},function errorCallBack(response){console.log('error:' +回复);});
我的json文件是:
< pre> {
Firstname:Me,
Lastname:Windy,
EMail:me.windy@shiny .com,
电话:0110110111
}
和我的HTML代码是:
< p ng-repeat =obj in UserObject>
{{obj.Firstname}}
< / p>
{{obj.Firstname}我没有文字。它是空的。
如果我用{{obj}}列出它我得到所有的东西。
webservice是ac#webservice (Asmx)和我转换jsonstring wie newtonsoft。
json文件有效。但我不明白为什么我不能选择{{obj.Firstname}}。
谢谢m8ts。
http({
method:'GET',
url:'url'
})
.then(function successCallback(response){
scope.UserObject = response.data;
},function errorCallBack(response){console.log('error:'+ response);});
我的json文件是:
< pre> {
名字:我,
姓氏:风,
电子邮件:me.windy@shiny.com,
电话:0110110111
}
和我的html代码是:
< p ng-repeat =obj in UserObject>
{{obj.Firstname}}
< / p>
{{obj.Firstname}我没有文字。它是空的。
如果我用{{obj}}列出它我得到所有的东西。
webservice是ac#webservice (Asmx)和我转换jsonstring wie newtonsoft。
json文件有效。但我不明白为什么我不能选择{{obj.Firstname}}。
感谢m8ts。
可能的JSON文件不正确。
以下是使用JSON字符串的示例
在angularjs中加载JSON数据 - JSFiddle [ ^ ]
以下是从URL读取JSON内容的示例
在angularjs中加载JSON数据 - JSFiddle - URL [ ^ ]
将两个JSON对象与应用程序生成的对象进行比较,它可能会给你一些线索。 / BLOCKQUOTE>
Hi Guys.
I need your help.
I wanna loop a json file in angularjs.
So far so good.
No Problem.
But now i have a problem :)
What I have tried:
The http call is:
$http({ method: 'GET', url: 'url' }) .then(function successCallback(response){ $scope.UserObject = response.data; }, function errorCallBack(response){console.log('error: ' + response);});
my json file is: <pre>{ "Firstname": "Me", "Lastname": "Windy", "EMail": "me.windy@shiny.com", "Phone": "0110110111" }
and my html code is:
<p ng-repeat="obj in UserObject"> {{ obj.Firstname }} </p>
With {{ obj.Firstname }} i get no text. it´s empty.
if i list it with {{ obj }} i get all entrys.
the webservice is a c# webservice (Asmx) and i convert the jsonstring wie newtonsoft.
the json file is valid. but i dont understand why i can´t choose {{ obj.Firstname }}.
thanks m8ts.解决方案http({ method: 'GET', url: 'url' }) .then(function successCallback(response){
scope.UserObject = response.data; }, function errorCallBack(response){console.log('error: ' + response);});
my json file is: <pre>{ "Firstname": "Me", "Lastname": "Windy", "EMail": "me.windy@shiny.com", "Phone": "0110110111" }
and my html code is:
<p ng-repeat="obj in UserObject"> {{ obj.Firstname }} </p>
With {{ obj.Firstname }} i get no text. it´s empty.
if i list it with {{ obj }} i get all entrys.
the webservice is a c# webservice (Asmx) and i convert the jsonstring wie newtonsoft.
the json file is valid. but i dont understand why i can´t choose {{ obj.Firstname }}.
thanks m8ts.
Possible the JSON file is incorrect.
Here is an example using JSON string
Load JSON data in angularjs - JSFiddle[^]
Here is an example reading JSON content from URL
Load JSON data in angularjs - JSFiddle - URL [^]
Compare the two JSON object with the one produce by your application, it might give you some clue.
这篇关于Angularjs JSON NG重复问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!