5
鑑於JSON對象(FORMDATA),我通過與AngularJS和輸出RealEstateInfo和PersonalTaxInfo對象試圖循環。對於我的生活,我似乎無法弄清楚如何查看房產名稱。有任何想法嗎?如何在AngularJS中訪問JSON屬性名稱(如果我不知道它是什麼)?
順便說一下,(鍵,值)不起作用。 鍵給我索引號,值整個對象。
<ul>
<li ng-repeat="item in formsData">
{{item.value}} //What goes here to get "RealEstateInfo" the 1st loop, and "PersonalTaxInfo" the second loop?
</li>
<ul>
$scope.formData = [
{
"RealEstateInfo": [
{
"Group": "General",
"Fields": [
{
"Name": "TitleType",
"Label": "Title Type",
"Type": "dropdown",
},
{
"Name": "NameIfAvailable",
"Label": "Name if available",
"Type": "string"
}]
},
{
"Group": "Personal",
"Fields": [
{
"Name": "TitleType",
"Label": "Title Type",
"Type": "dropdown",
},
{
"Name": "NameIfAvailable",
"Label": "Name if available",
"Type": "string"
}]
}]
},
{
"PersonalTaxInfo": [
{
"Group": "General",
"Fields": [
{
"Name": "TitleType",
"Label": "Title Type",
"Type": "dropdown",
},
{
"Name": "NameIfAvailable",
"Label": "Name if available",
"Type": "string"
}]
},
{
"Group": "PersonalInfo",
"Fields": [
{
"Name": "TitleType",
"Label": "Title Type",
"Type": "dropdown",
},
{
"Name": "NameIfAvailable",
"Label": "Name if available",
"Type": "string"
}]
}]
}]
@ rajkamal-非常感謝!雖然我並不完全理解嵌套的ng-repeat概念,但這很奏效。我認爲,這是一個嵌套的標準編碼實踐中的每個循環... – 2013-03-21 19:38:46
@rajkamal它是新的檢索屬性名稱雖然這,真的幫助! – ArifMustafa 2018-03-06 10:38:50