Cyclomatic complexity is a quantitative measure of the number of linearly independent paths through a program’s source code. Cyclomatic complexity over some threshold indicates that the logic should be moved outside the template.
The default complexity threshold is 5.
The threshold can be changed in your ESLint configuration by setting the maxComplexity
option for @angular-eslint/template/cyclomatic-complexity
rule.
<div *ngIf="a === '1'">
<div *ngFor="let person of persons; trackBy: trackByFn">
<div *ngIf="a === '1'">{{ person.name }}</div>
<div [ngSwitch]="person.emotion">
<app-happy-hero *ngSwitchCase="'happy'" [hero]="currentHero"></app-happy-hero>
<app-sad-hero *ngSwitchCase="'sad'" [hero]="currentHero"></app-sad-hero>
<app-confused-hero *ngSwitchCase="'confused'" [hero]="currentHero"></app-confused-hero>
<app-unknown-hero *ngSwitchDefault [hero]="currentHero"></app-unknown-hero>
</div>
</div>
</div>
<div *ngIf="a === '1'">
<div>{{ person.name }}</div>
</div>