API의 데이터를 드롭 다운에 표시하려고합니다 (Department Full Name). 하나의 값을 표시 할 수 있지만 여러 값을 표시 할 수는 없습니다. 내가 어디가 잘못 됐는지 말해 줄 수 있니?다른 배열의 여러 값을 드롭 다운에 추가하는 방법은 무엇입니까?
json 배열에서 선택 드롭 다운으로 값을 가져 오려고합니다. 드롭 다운으로 들어가기 원하는 값은 shortname, 학기 및 섹션입니다. 나는 shortName 만 표시 할 수 있지만 다른 2 개의 값은 표시 할 수 없습니다.
index.controller.js
$http.get('https://student.herokuapp.com/department/')
.success(function(response){
$scope.deptDetails=response.department;
// console.log($scope.deptDetails);
deptLen=response.department.sections.length;
console.log(deptLen);
for(var i=0;i<deptLen;i++){
$scope.deptDetails.push({"_id":response.department._id,
"shortName":response.department.shortName,
"section":response.department.sections[i].section,
"semester":response.department.sections[i].semester});
}
});
JSON 배열 여기
{
"department": {
"_id": "585955afce1a5e0011a2ecf5",
"collegeId": "58295efb836f8611d5e3e4cb",
"fullName": "Compcsuter Science",
"shortName": "CS",
"numberOfSemesters": "8",
"semesterYearScheme": "Semester",
"programName": "UG",
"numberOfSections": "1",
"sections": [
{
"_id": "585fb137bf29882207752552",
"collegeId": "585e53c6729e5c2214b97a0f",
"departmentId": "585fb137bf29882207752546",
"semester": 4,
"section": "C",
"syllabus": [],
"teachers": [],
"students": [],
"createdBy": "58332b90a7986c09b7e81980",
"createdAt": "2016-12-25T11:44:55.445Z",
"__v": 0
}
]
는 plnkr
는 당신이 언급하는 드롭 다운? – Sajeetharan
@Sajeetharan 오 죄송합니다. 나는 Departname 성을 언급하고 있습니다. – HebleV