Parameter value for ng-model directive in AngularJS:
Value
Description
name
The input name stores/updates the value of the input field into/from a variable.
Sample coding for ng-model directive in AngularJS:
Tryit<!DOCTYPE html><html><head><title>Wikitechy AngularJS Tutorials</title><scriptsrc="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/
angular.min.js"></script></head><body><h2>Wikitechy ng-model in AngularJS </h2><divng-app=" ">
Enter Text : <inputng-model="text"><h3ng-bind="text"></h3></div></body></html>
ng-model directive declaration in AngularJS:
The ng-model bind an input field value to AngularJS application variable by using ng-model name as “text”.
Enter Text : <inputng-model="text">
Code Explanation for ng-model directive in AngularJS:
AngularJS is distributed as a JavaScript file, and can be added to a HTML page with a <script> tag.
The AngularJS application is defined by ng-app=" ". The application runs inside the <div> tag. It’s also used to define a <div> tag as a root element.
The ng-model bind an input field value to AngularJS application variable by using ng-model name as “text”.
The ng-bind is used to bind the content of the HTML <input> field value to application data.
Sample Output for ng-model directive in AngularJS :
The output displays the textbox.
The output shows a two-way binding. If the user type “Welcome To AngularJS tutorials” in textbox then the AngularJS using ng-model for displayed that text.
ngmodel angularng-model controllerng-model selectng-model vs ng-bindng-model not workingangular model exampleng-model checkboxdata-ng-model vs ng-modelng-model not workingng-model exampleng model angulardata-ng-model vs ng-modelangularjs tutorials