Simple Two Way Data Binding Using AngularJS
Submitted by razormist on Tuesday, January 31, 2017 - 15:16.
In this tutorial, we will try to create a Simple Two Way Data Binding Using AngularJS. AngularJS is a structural framework for dynamic web apps. It is a kind of template that extends HTML to a new level of coding techniques. It is mostly used by other well known site for creating a template. So let's get started.
Creating A Mark-up
This a form for displaying the value when the user input a value. To do that open any kind of text editor(notepad++, etc..)
The code above will display the result when you enter a value in the textarea
ng-model - directive binds an input , select , textarea to a property on the scope using ng-myController which is created and exposed by this directive
{{result}} - after the data is bind, it will display the exact value that has been input
Creating A Script To Make AngularJS Worked
This script will make the angularJS to work with the mark-up form
The script above will typically create a module name "myModule" that will associate with controller function when included in the mark-up form.
There you have it we create a simple two way data binding using angularjs. I hope that this tutorial help you to your project. For more updates and tutorials, just kindly visit this site. Enjoy Coding!!
- <!DOCTYPE html>
- <html lang = "en">
- <head>
- <meta charset = "UTF-8" name = "viewport" content = "width=device-width, initial-scale=1"/>
- <link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css"/>
- </head>
- <body ng-app = "myModule">
- <nav class = "navbar navbar-default">
- <div class = "container-fluid">
- </div>
- </nav>
- <div class = "col-md-6 well" ng-controller = "myController">
- <hr style = "border-top:1px dotted #000;"/>
- <br />
- </div>
- </body>
- </html>
- var myApp = angular.module("myModule", [])
- .controller("myController", function($scope){
- });
Add new comment
- 13 views