這是我的link。Anguarjs如何重新格式化服務器收到的對象
假設從某處服務器接收到testDataArray,則根據testDataArray創建html佈局。
我需要做的是:一旦用戶輸入了某些東西,需要將testDataArray轉換爲對象之後的,然後發送回服務器。
,並希望印刷的對象應該是這樣的:
{
"Untitled Title 1": "sss",
"Untitled Title 2":"sss"
}
這裏是對象,從服務器
$scope.testDataArray =
[{
Question: {
title: { en: "Untitled Title 1"},
description: { en: "Untitled description 1"},
options: {value: {en:""}}
},Selection: "text"
},
{
Question: {
title: { en: "Untitled Title 2"},
description: { en: "Untitled description 2"},
options: {value: {en:""}}
},Selection: 'text'
}];
有人能幫助我在接受?非常感謝!
這不分配遞到你的答案陣列,但它確實表明在下面http://plnkr.co/edit/OgGQF5?p=preview – BenCr
@BenCr我希望部分的文本框的值標題答案對象被打印出來,格式與問題 – Justin
中的格式相同好的綁定非常直接,我在plnkr中顯示了一個例子,迭代一個數組並創建一個新的數組,這是isn 'domyworkforme.com,做一些研究。 – BenCr