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
我已更新。 –