2016-07-07 56 views
-2

我有一組數組的學生,他們的格式爲對象數組格式。該列表由Angular $ http Service返回。Angular:在過濾對象數組時遇到[filter:notarray]錯誤

當我使用angular.isArray進行測試時,它被證實是一個數組。

使用ng-repeat =「student in student | filter:searchText」的過濾器出現[filter:notarray]錯誤。該過濾器雖然工作。

我在做什麼錯?

回答

-1

對不起。通過以$ scope.students = {}開頭,弄亂了我的數組。在我的控制器中,然後; $ scope.students = data;在$ http呼叫之後。

刪除$ scope.students = {};修復了錯誤。