This article describes how to implement multiple selector in a same single directive:
@Directive({
selector: "[everySecond] , [everyTwoSeconds]",
outputs: [
"everySecond",
"everyTwoSeconds"
]
})
export class PingDirective implements OnInit, OnDestroy {
@HostListener('mouseleave') mouseleave(e:Event){}
@HostBinding('background-color') backgroundColor: string;
}
but when I denfine @HostListener
or @HostBinding
,both are for same directive PingDirective
.
Can you define it separately? To the following structure, you can listen to different span events and define css, everySecond
or everyTwoSeconds
.
<span everySecond>
everySecond
<span everyTwoSeconds>
everyTwoSeconds
</span>
</span>