Q:

how to pass ngModel value from input to *ngIf

I have an input field, I wanna pass its data by using [(ng model)] to *ngIf
<input type="text" [(ngModel)]="inputData">

<div *ngIf="cityName ==={{inputData}}; then mainpart else elsepart"></div>

<ng-template #mainpart>
  **Some Code Here**
</ng-template>

<ng-template #elsepart>
  **Some Code Here**
</ng-template>

I want when user enter some data in input field if data is matching with the condition then run mainpart else elsepart are run

A:

Try the below code
<div *ngIf="cityName === inputData; then mainpart else elsepart"></div>

Also you don't need to use interpolation in *ngIf Condition

