次のような検索語を入力しようとしています。
<div class="form-group">
<input type="text" class="form-control" ng-model="vm.search.term" placeholder="Enter search term">
</div>
そして、次のように、ng-repeat を使用してレンダリングされるオブジェクトの配列のフィルターとしてこの検索語を使用します。
<tbody>
<tr ng-repeat="p in vm.items track by $index | filter: vm.search.term">
<td><a>{{p.uid}}</a></td>
<td>{{p.em}}</td>
<td>{{p.ct | date:'medium'}}</td>
</tr>
</tbody>
しかし、開発者のコンソールでは、次のエラーが表示されます。
dashboard-js-bundle.min.js:117 Error: [filter:notarray] http://errors.angularjs.org/1.5.5/filter/notarray?p0=0
at dashboard-js-bundle.min.js:6
at dashboard-js-bundle.min.js:161
at fn (eval at compile (dashboard-js-bundle.min.js:230), <anonymous>:4:345)
at y (dashboard-js-bundle.min.js:298)
at dashboard-js-bundle.min.js:298
at dashboard-js-bundle.min.js:141
at n.$digest (dashboard-js-bundle.min.js:142)
at n.$apply (dashboard-js-bundle.min.js:145)
at l (dashboard-js-bundle.min.js:97)
at H (dashboard-js-bundle.min.js:101)
編集: アイテム配列は次のようになります。
(50) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]
0
:
{_id: "59d1f68dc1f8554acbb65533", __v: 0, cid: "59c89f29569cb11336420d3c", uid: "1234", em: "ap@gmai.com", …}
1
:
{_id: "59d2cd255b45b78d2108f399", uid: "2315", cid: "59c89f29569cb11336420d3c", em: "vf@gmail.com", tags: "l", …}
2
:
{_id: "59d2ce515b45b78d21090022", uid: "123", cid: "59c89f29569cb11336420d3c", em: "dan@gmail.com", tags: "h", …}
3
:
{_id: "59d2ce515b45b78d21090023", uid: "4561", cid: "59c89f29569cb11336420d3c", em: "lp@fg.com", tags: "Z", …}
4
:
{_id: "59d2d38c5b45b78d21093941", uid: "3412", cid: "59c89f29569cb11336420d3c", em: "gh@we.com", tags: "pl", …}
...
私が間違っていることと、それを修正する方法を見つけるのを手伝ってください。ティア。