Databinding – Two-Way-Databinding in Angular
server.component.ts
import {Component, OnInit} from '@angular/core'; @Component({ selector: 'app-server', templateUrl: './server.component.html', styleUrls: ['./server.component.css'] }) export class ServerComponent implements OnInit { public serverName = 'Test Server'; constructor() { } ngOnInit() { } }
server.component.html
<label>Server Name</label> <input type="text" [(ngModel)]="serverName"> <p>{{serverName}}</p>
References
https://github.com/mhdr/AngularSamples/tree/master/008/mya-pp