How to get the size of a filtered (piped) set in angular2 : <p>I wrote my own filter pipe as it disappeared in angular2:</p>

<pre><code>import {Pipe, PipeTransform} from 'angular2/core';

@Pipe({
  name: 'myFilter'
})
export class MyFilter implements PipeTransform {
  transform(customerData: Array&lt;Object&gt;, args: any[]) {
    if (customerData == undefined) {
      return;
    }
    var re = new RegExp(args[0]);
    return customerData.filter((item) =&gt; re.test(item.customerId));
  }
}
</code></pre>

<p>And use it in my template:</p>

<pre><code>&lt;tr *ngFor="#singleCustomerData of customerData | myFilter:searchTerm"&gt;
  ...
&lt;/tr&gt;
</code></pre>

<p>Now I'd like to see how many matches the pipe returns. So essentially the size of the returned array.</p>

<p>In angular 1.x we were able so assign the returned set to a variable in a template like so:</p>

<pre><code>&lt;div ng-repeat="person in filtered = (data | filter: query)"&gt;
&lt;/div&gt;
</code></pre>

<p>But we can no longer assign variables in templates in angular2.</p>

<p>So how do I get the size of the filtered set without calling the filter twice?</p>
