Tuesday, July 18, 2017

What is ng-model directive?

The primary purpose of this directive is bind the “View” to the “model”. We can bind the HTML controls (input, select, text area) value to application data.

One way data binding

One way data binding means that, it bind the data model to the view. Show figure in below. 


Example: 



















If the code is executed successfully, the following output will be shown below.



Two way data binding

The binding goes both ways.If the user changes the value inside the input field,the AngularJs property will also change its value.Show figure in below.



Example:



Output:





No comments:

Post a Comment