dubs dubs - 2 years ago 115
AngularJS Question

What's the difference between ng-model and ng-bind

I'm currently learning angularjs and am having difficulty understanding the difference between


Can anyone tell me how they differ and when one should be used over the other?

Answer Source

ng-bind has one-way data binding ($scope --> view). It has a shortcut {{ val }} which displays the scope value $scope.val inserted into html where val is a variable name.

ng-model is intended to be put inside of form elements and has two-way data binding ($scope --> view and view --> $scope) e.g. <input ng-model="val"/>.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download