Reputation: 3172
i'm new to angular, and strill trying to wrap my head around it. Say that I have a input text field. Upon update of this field, i want to update my database. I have a js function update(content) that i call to update my database.
with this purpose in mind, what is the difference between these two? One is wihtout the ng-model-options.
<input ng-model-options="{ updateOn: 'blur' }" ng-blur="update(item.text)" value="{{item.text}}" type="text">
<input ng-blur="update(item.text)" value="{{item.text}}" type="text">
Upvotes: 0
Views: 94
Reputation: 1759
Try looking on the details of all directive you have used in the Angular Doc.
For your functionality to achieve, you can use ng-change directive, which is triggerd on change on model connected to the input tag, and in the function, you can have ajax call to update the database.
<input ng-model="myModel" ng-change="updateDataBase()">
In Controller :
$scope.updateDataBase = function(){
//do ajax call and send $scope.myModel value.
}
Upvotes: 1