今天就跟大家聊聊有关angularjs中怎么使用ng-model-options设置数据同步,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。利用ng-
今天就跟大家聊聊有关angularjs中怎么使用ng-model-options设置数据同步,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
利用ng-model-options来实现,提高网站性能。
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="angular.min.js"></script>
</head>
<body>
<div ng-app="module" ng-controller="ctrl">
<!--updateOn:blur,鼠标离开时同步更新scope数据-->
<!--debounce:5000,数据输入完成后5秒,同步更新scope数据-->
<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}}
输入光标离开,立即更新,若不离开,2秒后更新
-->
{{title}}
</div>
<script>
var m = angular.module('module', []);
m.controller('ctrl', ['$scope', function ($scope) {
}]);
</script>
</body>
</html>
看完上述内容,你们对angularJs中怎么使用ng-model-options设置数据同步有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注编程网html频道,感谢大家的支持。
--结束END--
本文标题: angularJs中怎么使用ng-model-options设置数据同步
本文链接: https://www.lsjlt.com/news/75152.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0