How to Implement multiple search categories in one search

32 views
Skip to first unread message

Tejas Savaliya

unread,
Mar 11, 2019, 1:43:15 AM3/11/19
to Angular and AngularJS discussion
Hi Team,

I want to implement search component with multiple search categories and as per the search categories, I can search multiple search categories in one search box.

I have attached the image for the search component.

Let me know if you can find any solution.

Regards,
Tejas Savaliya
search-scenarios.png

Sander Elias

unread,
Mar 12, 2019, 8:01:17 AM3/12/19
to Angular and AngularJS discussion
Hi Tejas,

Nice idea. I'm not aware of such a component that can do this out of the box. 
For myself, I would start with building a pure filter that takes the existing choices and the complete dataset and returns the currently available choices, and then add that to an existing component.

Regards
Sander 

Tejas Savaliya

unread,
Mar 13, 2019, 3:37:43 AM3/13/19
to ang...@googlegroups.com
Hi Sander,

Yes It's new idea and I want to implement, so can you please give me some idea or let me know if you have made it this type of component.

Regards.
Tejas Savaliya

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Tejas Savaliya

unread,
Apr 4, 2019, 5:15:10 AM4/4/19
to ang...@googlegroups.com
Hi Sander,

Did you get chance to expore this things, can you please give me an idea to implement. I need your advise to implement such a thing to be complete.

Regards,
Tejas Savaliya

On Tue, Mar 12, 2019 at 5:31 PM Sander Elias <sande...@gmail.com> wrote:
--

Sander Elias

unread,
Apr 4, 2019, 6:42:30 AM4/4/19
to Angular and AngularJS discussion
Hi Teja,

I'm a bit too busy to go and sit down for this. I can give you some pointers:
import {of, BehaviorSubject, combineLatest} from 'rxjs';
import {map} from 'rxjs/operators';

interface Product {
id: number;
name: string;
tags: string[];
}

const products$ = of([] as Product[]);

const searchItems = new BehaviorSubject([] as string[]);

const results$ = combineLatest(products$, searchItems).pipe(
map(([products, tags]) => products.filter(pod => tags.every(tag => pod.tags.includes(tag))))
);


completely untested, but the idea is there.
You need to add a thing that includes all products if there are no filters yet.
(oh, and probably a thing or 2 more ;) )

hope this gets you going,
Regards
Sander
Reply all
Reply to author
Forward
0 new messages