In my angular app (with the angular material) I have a filter panel and I want besides select to be able to make autocomplete (user input value and it sends to the back-end, whereby $regexp query we find the match in MongoDB collection). But to do it I need manually inject service into filters component. I didn't find any info on how to do it.
I need something like this:
if (filters.serviceName) {
injector.inject(serviceName);
}
injector.get(serviceName).find(searchQuery);
Is it possible? Thanks.
Yes you can
inject
service dynamically using injector.get()Sample code :
Working demo