theMayer
theMayer

Reputation: 16177

Cannot disable tslint rule via Codelyzer on Angular Template

I have an Angular template that needs to call function by passing an index. There is a Codelyzer rule "template-no-call-expression" that complains when I do this.

I have attempted to disable the rule in the typescript file, but it continues to fail the lint check. Is this a bug, or am I not doing it correctly?

/* tslint:disable: template-no-call-expression */
@Component({
...

Upvotes: 1

Views: 1377

Answers (1)

Stephanie
Stephanie

Reputation: 538

Make sure the tslint-disabling is the FIRST line in your component.ts (so that means: above the imports)! I had the same problem and after reading the comment on the pull request below, I realized that if you put the disabling on line 17 of your TS, it will disable the check for all lines 17+ in your HTML file, but NOT for line 1 - 16 :\

See comment on https://github.com/mgechev/codelyzer/pull/492

Upvotes: 3

Related Questions