Dan,
The key to your solution appears to be ng:model="searchText"; which
does not seem to be documented in the
docs.angularjs.org.
I infer that it creates a controller [aka presentation model] property
called `searchText`; that controller property has an incoming binding
to the input DOM element value. Then you use closure to access that
property within the filter element.
Nice!
Would be great to see this approach (and ng:model) documented.
Thanks for your response.
On Jan 4, 6:49 pm, Dan Doyon <
dando...@yahoo.com> wrote:
> Thomas,
>
> the element you are getting would be the current element of the repeater. I took the angularjs example (
http://docs-next.angularjs.org/api/angular.Array.filter) and changed it to use a filter.
>
>
http://jsfiddle.net/dandoyon/Zqb6t/
>
> In this contrived example, I've created a FilterCtrl and am basically filtering based on value in searchText, if i don't test for undefined i get nothing. After this check i'm basically filtering only by the name element that starts with search text and is case insensitive. You can imagine that you could create a fairly complex filters. I think in most cases the regular filtering pattern would probably be sufficient.
>
> function FilterCtrl() {
> var scope = this;
> scope.doFilter = function(elem) {
> if(!scope.searchText) return true;
> return angular.lowercase(
elem.name).indexOf( angular.lowercase(scope.searchText)) == 0;
> };
>
> }
>
> --dan
>
> ________________________________
> From: ThomasBurleson <
thomasburle...@gmail.com>
> To unsubscribe from this group, send email to
angular+u...@googlegroups.com.