Why can't I pass multiple components to @ViewChildren?
Currently it is:
@ViewChildren(ColorFilterComponent, TransmissionFilterComponent)
public filters: QueryList<Filter>;
Both components implement my filter interface:
export declare abstract class Filter {
abstract applyFilter(vehicles: Vehicle): boolean;
}
At some point, I repeat through filtersand calling the method applyFilter()for all components in viewChildren.
However, when I make a simple log:
console.log(this.filters.toArray());
It contains only one filter. There is no other here.
What would be good good practice in this case?
source
share