Smart Filter Registry

The Smart Filter Registry service provides an easy way to get references to Smart Filter components, without the need of them being direct view children.

 

Obtaining a reference to a Smart Filter

HTML Markup
<smart-filter smart-object-name="customerFilter" ... ></smart-filter>
Component/Controller
import { SmartFilterRegistryService, ISmartFilter, FilterRegistryEvent } from '@consultingwerk/smartcomponents-filter';
 
private customerFilter: ISmartFilter;
 
constructor(private filterRegistry: SmartFilterRegistryService) { }
 
ngOnInit() {
	this.filterRegistry.filterRegistered
		.filter(ev.name === 'customerFilter' /** we are only intrested in the customer filter */)
		.subscribe((ev: FilterRegistryEvent) => {
			this.customerFilter = ev.smartFilter;
 
			//subscribe to the filter's "filter" event
			this.customerFilter.onFilter.subscribe(ev => { //your custom logic here });
		});
}