I am trying to figure out how to pass an element reference to a directive. I know that I can get the reference of the element where the directive is applied using
private _elemRef: ElementRef
but my goal is to pass the reference of another element to the directive. Any guidance on how to achieve this would be greatly appreciated.
Below is a snippet of code showcasing what I'm working on. In this case, I have a ripple
directive.
<ul #other>
<li ripple>Hello</li>
</ul>
directive.js
@Directive({
selector: '[ripple]'
})
export class RippleDirective {
constructor(private _elemRef: ElementRef) {
}
@HostListener('click', ['$event'])
public onClick(event: MouseEvent) {
// I want to refer to the '#other' node here
}
}