ng-repeat对json数组不起作用

时间:2021-11-09 19:44:19

I have this json array

我有这个json数组

[ 
{ Company: 
{ id: "19", features_id: null, features: "a:6:{i:1;s:1:"1";i:2;s:1:"2";i:3;s:1:"3";i:4;s:1:"0";i:5;s:1:"0";i:6;s:1:"6";}" }, User: [ ] }, -{ Company: 
{ id: "20", features_id: null, features: "a:6:{i:1;s:1:"1";i:2;s:1:"2";i:3;s:1:"3";i:4;s:1:"4";i:5;s:1:"5";i:6;s:1:"6";}" }, User: 
[ 
{ id: "1", group_id: "1", type: null } ] }]

[{Company:{id:“19”,features_id:null,features:“a:6:{i:1; s:1:”1“; i:2; s:1:”2“; i:3 ; s:1:“3”; i:4; s:1:“0”; i:5; s:1:“0”; i:6; s:1:“6”;}}}},用户:[]}, - {公司:{id:“20”,features_id:null,功能:“a:6:{i:1; s:1:”1“; i:2; s:1:”2 “; I:3; S:1:” 3 “; I:4; S:1:” 4 “; I:5; S:1:” 5 “; I:6; S:1:” 6" ; }},用户:[{id:“1”,group_id:“1”,类型:null}]}]

for somereason I cant get data into my div. Anyhelp will be appreciated. here is the jsfidler

因为某些原因我无法将数据输入我的div。任何帮助将不胜感激。这是jsfidler

http://jsfiddle.net/4Y9L3/

http://jsfiddle.net/4Y9L3/

2 个解决方案

#1


4  

That JSON is not valid. Also, your template is not going to output anything visible unless you put some bind tags in the repeater like {{Company.Company.id}} for example.

那个JSON无效。此外,您的模板不会输出任何可见的内容,除非您在转发器中放置一些绑定标记,例如{{Company.Company.id}}。

#2


1  

You are using $.ajax(), so Angular doesn't know about it.

你使用$ .ajax(),所以Angular不知道它。

Use $http like this http://jsfiddle.net/4Y9L3/5/.

像这样http://jsfiddle.net/4Y9L3/5/使用$ http。

#1


4  

That JSON is not valid. Also, your template is not going to output anything visible unless you put some bind tags in the repeater like {{Company.Company.id}} for example.

那个JSON无效。此外,您的模板不会输出任何可见的内容,除非您在转发器中放置一些绑定标记,例如{{Company.Company.id}}。

#2


1  

You are using $.ajax(), so Angular doesn't know about it.

你使用$ .ajax(),所以Angular不知道它。

Use $http like this http://jsfiddle.net/4Y9L3/5/.

像这样http://jsfiddle.net/4Y9L3/5/使用$ http。