0
我有对象列表,如下所示,其中有对象嵌套在对象内。 我想使用ng-repeat显示信息,但它不起作用。ng-repeat用于显示对象列表中的嵌套对象
<div ng-repeat="x in customer">
{{x.name}}
</div>
AngularJs代码
var myapp=angular.module('myapp',[]);
myapp.controller('MyController',['$scope',function($scope){
$scope.val="this is test";
$scope.customer=
[1:{
name:{
firstname:"",
lastName:""
},
address:{
city:"city",
country:"country",
zipCode:65775
}
},
//other customer data
];
});
为简单对象名单NG重复效果很好。我无法处理发生错误的复杂对象。
这将输出另一个div与嵌套对象中的每个属性的信息。编辑:现在它是正确的。 – Chrillewoodz
我已更新。 –