這是我在上面的代碼代碼如何在angularjs中將對象推送到數組?
$scope.studentDetails=[];
$scope.studentIds={};
$scope.studentIds[0]{"id":"101"}
$scope.studentIds[1]{"id":"102"}
$scope.studentIds[2]{"id":"103"}
當我選擇學生id:101
我有痕從服務,如
$scope.studentMarks={};
$scope.studentMarks[0]{"marks":"67"}
$scope.studentMarks[1]{"marks":"34"}
未來
我選擇學生id:102
我有痕從服務,如
$scope.studentMarks={};
$scope.studentMarks[0]{"marks":"98"}
$scope.studentMarks[1]{"marks":"85"}
終於我想將學生的詳細信息存儲到一個數組中,如
$scope.studentDetails=[{"id":"101","marks":[67,34]},{"id":"102","marks":[98,85]}]
使用angularjs。
它不是真正清楚你在這裏幹什麼,甚至你的問題是什麼。你展示了一些正在創建的對象,然後像它們是數組一樣引用它們,然後顯示一個數組,你似乎希望成爲其中一個對象的產品加上另一個對象的數組表示。你的語法在這裏完全不起作用。 – Claies