I have two selectors dirA
and dirNotA
for my directive. The directive should proceed further based on the selector used. Is there any way to determine which selector was used within the directive?
I do not wish to have multiple directives nor a directive with parameters. I wish to have one directive with multiple selectors and to determine the course of action based on the selector used in the template.
Something like this
@Directive({
selector: '[dirA], [dirNotA]`
})
class DirectiveA implement OnInit {
ngOnInit() {
// here we detected which selector was used
if (dirASelector) {
...
}
}
}
Any ideas how can get this information in the directive itself?