While working with NgRx, I came across the following error message:
'Expected an assignment or function call and instead saw an expression.'
I encountered a Sonar issue in my code snippet
this.sfForm.get('code')?.[this._mode ? 'disable' : 'enable']();
. I'm struggling to interpret this message from Sonar and figure out how to resolve it.
If anyone can help me understand the code better and assist in resolving the issue, that would be greatly appreciated.
<mat-form-field [formGroup]="sfForm">
<input Input
matInput
(keydown.enter)="search($event.target.value)"
[type]="''"
formControlName="code"
required>
</mat-form-field>
sfForm: FormGroup;
private _mode: boolean = true;
public set scanMode(value: boolean) {
this._mode = value;
this.sfForm.get('code')?.[this._mode ? 'disable' : 'enable']();
}