1. Home
  2. Languages
  3. AngularJS
  4. Mastering ng-model: Two-Way Data Binding in AngularJS

Mastering ng-model: Two-Way Data Binding in AngularJS



2. Bind the input using ng-model

Add an input element with the ng-model directive referencing a scope variable — in this case, message:

3. Display the bound value in real time

To see the instant binding effect, add a display paragraph:

You typed: {{ message }}

Full HTML code

Here’s what the full HTML looks like combining all the above:

<!DOCTYPE html>




ng-model Input Binding Example


AngularJS ng-model Input Binding

You typed: {{ message }}

Updated on July 4, 2025
Was this article helpful?

Related Articles

Leave a Comment