The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
<!DOCTYPE html> <html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <body> <div ng-app=""> <p>Input something in the input box:</p> <p>Name : <input type="text" ng-model="name" placeholder="Enter name here"></p> <h1>Hello {{name}}</h1> </div> </body> </html>
Output:
Use of ng-model in angular JS with example
Working Code Edited question September 21, 2023