angular_analyzer_plugin icon indicating copy to clipboard operation
angular_analyzer_plugin copied to clipboard

Flag error if $event used in inline-template without backslash

Open mk13 opened this issue 8 years ago • 2 comments

Inline template usage of $event must be preceded by \

mk13 avatar May 16 '17 18:05 mk13

except when it's a raw string

...
template: r'<button (click)="$event">click me</button>',
...

zoechi avatar May 17 '17 07:05 zoechi

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.

MichaelRFairhurst avatar May 17 '17 16:05 MichaelRFairhurst