How to Use Filter to filter multiple columns from one textbox

9,116 views
Skip to first unread message

Hardik

unread,
Apr 26, 2013, 6:11:30 AM4/26/13
to ang...@googlegroups.com
Hey guys,

I have a data like,

"candidates": [
        {
            "id": 1,
            "guid": "f2b97ccd-3041-476e-b7f9-c0bdc9633d8f",
            "picture": "http://placehold.it/32x32",
            "age": 34,
            "name": "Lily Thornton",
            "gender": "female",
            "title": "Web Designer",
            "company": "Steganoconiche",
            "city": "CoralSprings",
            "phone": "858-490-3636",
            "email": "test...@steganoconiche.com",
            "address": "24839, Wall Street",
            "registered": "2011-10-01T08:45:48 -06:-30"
        },
        {
            "id": 2,
            "guid": "926a293a-25a3-431b-86d1-5e65d3403a8f",
            "picture": "http://placehold.it/32x32",
            "age": 28,
            "name": "Aaliyah Morrison",
            "gender": "female",
            "title": "Web Developer",
            "company": "Netsystems",
            "city": "Clearwater",
            "phone": "841-586-3331",
            "email": "asfas...@netsystems.com",
            "address": "34108, Wall Street",
            "registered": "1992-01-21T16:53:23 -06:-30"
        },


And i have text box for searching City,Address only and i need to need is it possible to do it via normal filter ?

<input type="text" ng-model="search.address | search.city"  class="input-xlarge" placeholder="City, State or Postal Code">

Does not work....:(

if i use single attribute it works but multiple attributes on filter does not work.

Can anyone show me way around ?

 
Thanks

Hardik

unread,
Apr 26, 2013, 10:01:11 AM4/26/13
to ang...@googlegroups.com
I think Plunker will help this understand easily...


What i want is if you see search text box it searches search.city via filter. i want to search city as well as address via one text box only. is this possible ?

Guy Veraghtert

unread,
Apr 26, 2013, 10:37:45 AM4/26/13
to ang...@googlegroups.com
Do you mean something like this?

Hardik Dangar

unread,
Apr 26, 2013, 10:41:21 AM4/26/13
to ang...@googlegroups.com
Hey guy,

Yep that's what i want, I know the custom filters but i was expecting something like 

ng-model="search.city|search.address" :)

Thanks,
Hardik



--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/PXyl6Ux5ldU/unsubscribe?hl=en-US.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages