Using Angular filter with pagination
<p>I am using a filter on an array of items in a ng-repeat like this:</p>

<pre><code>&lt;input type="text" ng-model="filterText"&gt;

&lt;li ng-repeat="item in displayItems | filter : {item_name: filterText}&gt;
</code></pre>

<p>This works fine and filters the items perfectly.The problem arises because I am using displayItems with a uib-pagination element. The pagination uses totalItems instead of displayItems.</p>

<pre><code>&lt;uib-pagination class="pagination-sm pagination"
    total-items="totalItems.length" ng-model="page" ng-change="changeItems()"&gt;
&lt;/uib-pagination&gt;
</code></pre>

<p>Obviously I need to somehow apply the filter on the total-items, then create the displayItems, and put the filteredItems in the uib-pagination.</p>

<p>Ie. When the person types, in the controller the filter is applied to the totalItems, and I create the filteredItems needed for the pagination. I also then create the displayItems from the filteredItems. How do I go about putting this into the controller and not in the HTML for the ng-repeat?</p>

<p>I'm not sure how to do this. Any thoughts? All help much appreciated....</p>

<p>I've included a plunker to show it (not) working in all its glory....
<a href="https://plnkr.co/edit/EYX6zO1795sD9TYq2J8U?p=preview" rel="noreferrer">https://plnkr.co/edit/EYX6zO1795sD9TYq2J8U?p=preview</a></p>