我有两个变量:
第一个:
studentSearchCriteria1= {"studentList1":"key":"firstName","match":$scope.firstName, "value":$scope.studentSearchCriteria.studentfName},],"searchUserInformationKey": [ "",],"start": 0}
和第二个:
var studentSearchCriteria1 = {"studentList2":[{"key":"lastName","match":$scope.firstName,"value":$scope.studentSearchCriteria.studentlName},],"searchUserInformationKey":["",],"start": 0}
我想将一个数组的内容添加到另一个数组,结果应为:
{"studentList1": [{"key":"firstName","match":$scope.firstName,"value":$scope.studentSearchCriteria.studentfName},{"key":"lastName","match":$scope.firstName,"value":$scope.studentSearchCriteria.studentlName},],"searchUserInformationKey":["",],"start": 0}
答案 0 :(得分:0)
您可以使用javascript push
方法和角度复制方法angulat.copy(json)
。
studentSearchCriteria1.studentList1.push(angular.copy(secondJson));