當我有喜劇搜索,然後它也給我們想要的結果
過濾只有標題不與類別。所以計數和結果將是錯誤的。 任何機構都可以告訴我們如何開發自定義過濾器,或者使用其他任何方式。過濾器無法正常工作與組通過角js
我的代碼是
<script>
var myApp = angular.module('myApp', ['angular.filter']);
myApp.controller("MyController", function ($scope)
{
$scope.movies =
[
{ title: 'The Matrix', rating: 7.5, category: 'Action' },
{ title: 'Focus', rating: 6.9, category: 'Comedy' },
{ title: 'The Lazarus Effect', rating: 6.4, category: 'Thriller' },
{ title: 'Everly', rating: 5.0, category: 'Action' },
{ title: 'Maps to the Stars', rating: 7.5, category: 'Drama' }
];
});
</script>
<div ng-controller="MyController">
<div class="searchBar">
<input type="text" name="title" ng-model="title" placeholder="Search..." />
</div>
<ul class="angularList" ng-repeat="(key, value) in movies | groupBy: 'category'">
<h3>{{ key }} ({{ value.length }})</h3>
<li ng-repeat="movie in value | filter:title">
<a href="#">{{ movie.title }}</a><br />
<div class="rating_box">
<div class="rating" style="width:{{movie.rating*10}}%"></div>
</div>
</li>
</ul>
</div>
使用這樣的事情對標題應用過濾器只NG-在電影中重複=「(鍵,值)|過濾器:{title:title} –
我不明白這個問題,請你舉個例子解釋你在做什麼,你期望發生什麼期望的輸出)以及實際發生了什麼(例如實際輸出)? –
是y ou添加** angular filter.js ** [只需瀏覽一次](https://github.com/a8m/angular-filter) – Sai