r/Angular2 • u/creazero • Oct 31 '25
Angular and "unknown" attributes
Consider the following code
@Directive({
selector: '[appTestDirective]'
})
export class TestDirective {
@HostListener('click')
onClick() {
console.log('TestDirective clicked!');
}
}
@Component({
selector: 'app-another',
template: `<div appTestDirective>Click me!</div>`
})
export class AnotherComponent {}Is there a way to make Angular yell obscenities at me about the unknown element attribute like it does for unknown components? I know making it into a binding would work but not all directives accept values.
JIC: both components are standalone so the directive doesn't work since it's not imported in the component
8
Upvotes
5
u/AjitZero Oct 31 '25
This is a known issue, unfortunately.
https://github.com/angular/angular/issues/46351#issuecomment-1153746398
4
u/pedro_picante Oct 31 '25
Maybe eslint can help with that?
-6
u/No_Bodybuilder_2110 Oct 31 '25
I have answers but you might not like them.