1
我的AngularJS應用程序應該在表格中顯示課程及其等值。該表應該根據select元素的輸入動態顯示結果。
HTML
<form name = "Select University" ng-show = "courseType == 'extern'">
<label for = "University"> University: </label>
<select name = "University" id = "repeatSelect" ng-change = "changeIt()"ng-model = "univs.repeatSelect">
<option ng-repeat = "univ in univs.uniNames | orderBy: 'School'" > {{univ.School}} </option>
</select>
</form>
Courses at {{univs.repeatSelect}}
<table>
<tr>
<th> Course </th>
<th> Equivelance </th>
</tr>
<tr ng-repeat="x in names | orderBy: 'className' | filter:univs.repeatSelect">
<td>{{ x.className }}</td>
<td> {{x.equiv}} </td>
</tr>
</table>
的JavaScript
$http.get("http://linux.students.engr.scu.edu/~cmulloy/COEN174/getSchools.php")
.success(function (response)
{
$scope.univs.uniNames = response.records;
});
$scope.univs =
{
repeatSelect: null,
uniNames: null,
};
範圍變量{{univs.repeatSelect}}
顯示在頁面上。例如,它將在桌面上方顯示「加州大學洛杉磯分校的課程」。但是當我使用univs.repeatSelect
作爲ng-repeat
的過濾參數時,表格爲空。但是,如果我明確使用'UCLA'作爲過濾器參數,它將起作用並顯示UCLA中的課程。有什麼我失蹤?
@Charles Mulloy有幫助嗎? –