TemplateUrl can be not only a value. It can be a function with any arguments, which returns a value as URL. See how it looks.
There are two ways to count items in a filtered AngularJs list used in ngRepeat: to get filter count either in template or in controller. See how to do it.
Learn How to use Angularjs filters. AngularJs lets us create custom filters and use it like you use other filters. Try examples yourself and see the result.