SoFunction
Updated on 2025-04-13

Method for setting data synchronization in angularJs ng-model-options

When the backend request task is large, you can set the synchronization time and operation.

Use ng-model-options to achieve it to improve website performance.

<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <script src=""></script>
</head>
<body>
<div ng-app="module" ng-controller="ctrl">
<!--updateOn:blur,Synchronous updates when the mouse leavesscopedata-->
<!--debounce:5000,data输入完成后5Second,Synchronous updatesscopedata-->
  <input type="text" ng-model="title" ng-model-options="{updateOn:'default blur',debounce:{default:2000,blur:0}}">
  <!--ng-model-options="{updateOn:'default blur',debounce:{default:2000,blur:0}}
  Enter the cursor to leave,Update now,If you don't leave,2Second后更新
-->
  {{title}}
</div>
<script>
  var m = ('module', []);
  ('ctrl', ['$scope', function ($scope) {
  }]);
</script>
</body>
</html>

The above method of setting data synchronization in angularJs is all the content I share with you. I hope you can give you a reference and I hope you support me more.