我有一張我希望能夠搜索的表格。它對測驗題目很好,但課程名稱似乎不起作用。我知道這是因爲課程標題是在另一個字典裏,因爲如果我把「course」而不是「course.title」放在另一個字典中,它會起作用,但它在整個課程對象內搜索,而不僅僅是標題,我不想要它。我怎樣才能搜索只有course.title?我認爲這只是一個語法問題,但我無法在任何地方找到類似的問題。通過AngularJS智能表中的對象內部的對象進行搜索
<table st-table="displayedQuizzes" st-safe-src="quizzes" class="table table-striped">
<thead>
<tr>
<th st-sort="quiz.title">Name</th>
<th st-sort="quiz.course.title">Course</th>
</tr>
<tr>
<th><input st-search="'title'" class="input-sm form-control" placeholder="Search ..." type="search"/></th>
<th><input st-search="'course.title'" class="input-sm form-control" placeholder="Search ..." type="search"/></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="quiz in displayedQuizzes">
<td>{{quiz.title}}</td>
<td>{{quiz.course.title}}</td>
</tr>
</tbody>
</table>
這是我的角度代碼:
angular.module('App')
.controller('ArchiveCtrl', ['$scope', '$window', 'Archive, function ($scope, $window, Archive) {
$scope.quizzes = Archive.query();
}]);
你能告訴角碼? – Gericke
我剛添加它 – arfasvin
控制器聲明中有一個錯誤'.controller('ArchiveCtrl',['$ scope','Archive,function($ scope,$ window,Archive){' - 你沒有定義' $ window'作爲輸入參數 – Michael