【发布时间】:2016-05-30 06:26:34
【问题描述】:
我需要访问 html 文件中的 api 数据,它在我的控制器中以 json 格式存在... 我正在尝试两种方式,但现在可以访问了
$scope.examFilterData_College = data[0].colleges;
$scope.examFilterData_Course = data.courses;
{
"status": "sucsuss",
"data": [{
"colleges": [{
"Name": "Amity Institute of Horticulture Studies and Research, Noida",
"mySql_college_id": "143"
}, {
"Name": "Amity Institute of Nuclear Science & Technology, Noida",
"mySql_college_id": "156"
}, {
"Name": "Amity School of Engineering and Technology, Noida",
"mySql_college_id": "73"
}]
}, {
"courses": [{
"Name": "B Tech Civil Engineering",
"Level": "Bachelors"
}, {
"Name": "B Tech Automobile Engineering",
"Level": "Bachelors"
}, {
"Name": "B Tech Electronics & Communication Engineering",
"Level": "Bachelors"
}, {
"Name": "B Tech Electrical & Electronic Engineering",
"Level": "Bachelors"
}, {
"Name": "B Tech Computer Science & Engineering",
"Level": "Bachelors"
}, {
"Name": "B Tech Electronics & Instrumentation Engineering",
"Level": "Bachelors"
}, {
"Name": "B Tech Horticulture",
"Level": "Bachelors"
}, {
"Name": "B Tech Information Technology",
"Level": "Bachelors"
}, {
"Name": "B Tech Mechanical Engineering",
"Level": "Bachelors"
}, {
"Name": "B Tech Nuclear Science Engineering",
"Level": "Bachelors"
}]
},
[]
]
}
使用在线json编辑器以正确的格式查看。
【问题讨论】:
-
我想访问课程和学院的名称
-
那么你想从中得到什么?课程或学院或两者兼而有之?
-
课程和学院在同一对象或不同对象中,
标签: javascript jquery angularjs json