How does data binding work in the AngularJS
framework?
I haven\'t found technical details on their site. It\'s more or less clear how it works when data
AngularJs supports Two way data-binding.
Means you can access data View -> Controller & Controller -> View
For Ex.
1)
// If $scope have some value in Controller.
$scope.name = "Peter";
// HTML
{{ name }}
O/P
Peter
You can bind data in ng-model
Like:-
2)
{{ name }}
Here in above example whatever input user will give, It will be visible in If want to bind input from html to controller:- Here if you want to use input
3)
name
in the controller then,$scope.name = {};
$scope.registration = function() {
console.log("You will get the name here ", $scope.name);
};
ng-model
binds our view and render it in expression {{ }}
.
ng-model
is the data which is shown to the user in the view and with which the user interacts.
So it is easy to bind data in AngularJs.