Two-Way Data Binding in Angular 8

This project will demonstrate how to use Two-Way Data Binding in Angular 8

  • Angular8
    • src
      • app
        • app.component.html
        • app.component.ts
        • app.module.ts
<form>
    <input type="text" [(ngModel)]="result" [ngModelOptions]="{standalone: true}">
    <br>
    {{result}}
</form>
import { Component, OnInit } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html'
})

export class AppComponent implements OnInit {

    result: string;

    ngOnInit() {
        this.result = 'Use Two-Way';
    }

}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { AppComponent } from './app.component';

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        FormsModule
    ],
    providers: [],
    bootstrap: [AppComponent]
})

export class AppModule { }

Screenshots