While writing my angular application, I got this "strange" error message:
The code runs perfectly fine and I couldn't find any documentation for this error message. What does it mean?
The code is from : https://stackoverflow.com/a/45144391/639035 which is an accepted answer with 15 up votes.
Code:
<input placeholder="TEST"
[ngModel]="phone_numbers && phone_numbers[0]?.full_number"
(ngModelChange)="phone_numbers?.length && phone_numbers[0].full_number=$event">
Error Message:
Must be lvalue
Must be lvalue
This is how webstorm inspection by using JSAnnotator works.
Try creating simple js file with the following code:
let a,b;
a && b=1;
It would be better if that error would sound like:
ReferenceError: invalid assignment left-hand side
See also issue
Webstorm warns us that this code is unusual case and we can be wrong with writting it, for example
if (a === 1 && b = 2) {
/\
Seems it should be == or ===.
So it's easy to make such mistake like this
How can we suppress this error?
(ngModelChange)="phone_numbers?.length ? phone_numbers[0]['full_number']=$event : null"
input
element<!--suppress JSAnnotator -->
<input placeholder="TEST"
[ngModel]="phone_numbers && phone_numbers[0]?.full_number"
(ngModelChange)="phone_numbers?.length && phone_numbers[0]['full_number']=$event">
Again, it's just a warning and it's up to you how to deal with it.