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>
AngularJS ng-model Input Binding
You typed: {{ message }}