angular_analyzer_plugin
angular_analyzer_plugin copied to clipboard
Flag error if $event used in inline-template without backslash
Inline template usage of $event must be preceded by \
except when it's a raw string
...
template: r'<button (click)="$event">click me</button>',
...
I think of this as "the identifier 'event' should not be interpolated without braces unless its successfully resolved"
So Gunter's example is not interpolation and would be OK. Adding a backslash prevents interpolation so the fix is correct.
But also:
const event = "click";
@Component(template: '<div ($event)="foo(\$event)"> ...
should be OK.