IFrizy
IFrizy

Reputation: 1745

Difference between ng-model and ng-model-instant AngularJS

What difference between ng-model and ng-model-instant? When I can use ng-model-instant and ng-model?

Could you give me any example?

Thanks.

Upvotes: 12

Views: 8309

Answers (3)

Sachin
Sachin

Reputation: 1

Though the functionality of ngModel and ngBind attribute seems nearly same as both helps in binding data with element but there is a big difference between two. In actual both are totally alike to each other.

ngModel enables two way binding between view and model whereas ngBind only helps in showing data on element. Use ngModel with controls like checkbox, text which has value attribute and use ngBind with elements like span or div which has text attribute.

Upvotes: 0

Davin Tryon
Davin Tryon

Reputation: 67296

ng-model-instant is deprecated.

ngModelInstant directive is no more and ngModel behaves just as ngModelInstant used to. This doesn't really break anything, just remember to remove all ngModelInstant references from your template as they serve no purpose now.

From here.

It seems that from version 1.0.0rc4 and above ng-model-instant behave exactly like ng-model.

Upvotes: 3

Steve Klösters
Steve Klösters

Reputation: 9457

ng-model-instant was removed in one of the 1.0 release candidates, and ng-model now behaves that way. Before that 1.0 RC, ng-model-instant was triggered on every key press and ng-model on every blur. See the changelog.

Upvotes: 19

Related Questions