- Forums
- Angular
- Angular [2020] - Simple Two Way Binding With [(ngModel)] Input Form
This is a simple example of two-way binding in angular using [(ngModel)]
 [4808], Last Updated: Mon Jun 24, 2024 
 
 angular2020
 Sat May 02, 2020 
 0 Comments
 1919 Visits
[(ngModel)]
To use two-way binding in angular, we can use this simple example. x= Whatever Component
- app.module.ts
import { FormsModule } from '@angular/forms'; ADD FormsModule in imports:
- x.component.ts
 Add superHero= "superman"; after  export class HeroesComponent implements OnInit {
- x.component.html ADD THE FOLLOWING HTML:
 <h2>{{superHero| uppercase}} Details</h2>
 <input [(ngModel)]="superHero" placeholder="name"/>
Its that simple, enjoy