Unknown input property error in Angular Js

When we want to bind an ngModel to the input field we usually write it like this



        <input  type="text" [ERROR ->][(ngModel)]="test" placeholder="foo" />


but then the unknown input property error shows up.We will see how to solve this.

In Anglular 2,4 and 5 before using [(ngModel)] make sure FormsModule is imported from Angular form.Also check for the line

import { FormsModule } from '@angular/forms';

in app.module.ts