Understanding Two-Way Data Binding in AngularJs

Hands down two-way data binding is one of the biggest strengths of AngularJs. Because now, it seems impossible to work without it. Because this was so NEEDED! So, lets get straight into it and understand it to the core.

 

ONE-WAY DATA BINDING( Before AngularJS)

Before Two-Way Binding, View and Model were two separate entities and there was no relation between them as such that the changes could be in sync, hence it was the responsibility of the developer to capture the changes in the view  and reflect them on model, and similarly changes done at model been reflected in the view. The diagram below represent the earlier traditional approach of data binding.

                                  

 

TWO-WAY DATA BINDING( In AngularJS)

Now. with DATA -BINDING in AngularJS, View reflects the changes in model bound by ng-model and model reflects the changes in the view which are given in the {{}}brackets. Here, there is no role of controller and need for developer to sync them, hence has made coding excessively easier. Here, the view knows to bind through the model present in ng-model which is “user” here. And view would reflect the changes and directly bind the model’s value through {{}}

 


 

Hope, it would have made you clear with the data binding concept. If you still have an any doubt, leave it in the comment section below. Our team would revert back within 24 hours.

Do Follow our Facebook page https://www.facebook.com/lovebeingengineer/.

Similar Blogs:

Forms in AngularJs

 

Templates And Expressions in AngularJs

 

Journey of Angular

 

Controllers in AngularJs

 

Services in AngularJs

$scopes in AngularJs

Dependency Injection in AngularJs!

 

 

Leave a Reply