How to filter data according to strict match

57 views
Skip to first unread message

Mayur Doshi

unread,
Dec 8, 2014, 5:24:30 AM12/8/14
to ang...@googlegroups.com

i want to filter data on the fly when data is provided to ng-grid in angular. what i am trying to achieve is that when i filtering 'Nephi' then all the data which contain 'Nephi' with its.

I am providing a plunker link to better understand:

http://plnkr.co/edit/ROACCzIMBpukJimtBQnI

Like if i search 'Nephi' then it should only give me 1 result or exact result

(expected result)

1. Nephi

but right now it is giving me

1. Nephi

2. Nephiss

3. Nephisss

santosh keswani

unread,
Dec 8, 2014, 9:50:25 AM12/8/14
to ang...@googlegroups.com
In MVC you can do one thing you can write functionality at server side and call that function which will return you json objects.
you can write SQL query like SELECT * FROM WHERE Name ='Nephi';
then assign that result to myData

Sander Elias

unread,
Dec 8, 2014, 11:52:22 AM12/8/14
to ang...@googlegroups.com

Hi Mayur,

I don’t know about uiGrid, but in angular itself, the filter function has a 3rth parameter, that forces an strict equal.
in the controller you use this as:
$filter('filter')(arr,'Nephi',true)

I’m pretty sure this translates to uiGrid also!

Regards
Sander

Mayur Doshi

unread,
Dec 8, 2014, 11:53:31 PM12/8/14
to ang...@googlegroups.com
Hi Sander,
Thanks for you reply i have worked it with it helped me.

Thanks ones again.

--
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/Uot84Ek3IMk/unsubscribe.
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.
For more options, visit https://groups.google.com/d/optout.



--
Thanks and Regards,

Mayur Doshi | mayur...@gmail.com  | +91 90382 66795 |
Reply all
Reply to author
Forward
0 new messages