one-way VS two-way data binding
One-Way Data Binding
ng-bind
hasone-way data binding
($scope --> view).
Eg.,ng-bind="myText"
OR{{myText}}
which displays the scope value$scope.myText
inserted into html wheremyText
is a variable name.
Two-Way Data Binding
ng-model
is intended to be put inside of form elements and hastwo-way data binding
($scope --> view and view --> $scope) e.g.<inputname="firstname"ng-model="firstname"/>
When you interact with form elementfirstname
thatng-model
interact with$scope.firstname
and update the corresponding view automatically by digest loop.
Last updated
Was this helpful?