Angular 5 Checking the value of a variable on and *ngIf statement

change it to item==='somevalue'. typo probably


You are doing an assignment using single = operator.

Use double equal to == operator to check equality or better use === to check strict equality.

<div *ngIf="item === 'somevalue'">

You are making assignment instead of comparison

<div *ngIf="item==='somevalue'">

*ngIf work like this *ngIf="expression" where the expression is replaces with the simple Javascript statement which returns boolean. But you use one = and it means that you assign the someValue to the item property and if the value is not falsy it will return you true.

In your case you need to write *ngIf="item === 'somevalue'".