Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 非输入时的模型去抖动_Javascript_Angularjs - Fatal编程技术网

Javascript 非输入时的模型去抖动

Javascript 非输入时的模型去抖动,javascript,angularjs,Javascript,Angularjs,我知道你可以用ng模型将debounce放在任何地方。但是,如果同一对象有多个ng模型,并且只有一个位置可以“显示”它,该怎么办。我想改为在“display”元素设置debounce 例如,如何使名称在中缓慢显示,但在输入之间快速同步: HTML <!DOCTYPE html> <html ng-app="plunker"> <head> <meta charset="utf-8" /> <title>Angul

我知道你可以用ng模型将debounce放在任何地方。但是,如果同一对象有多个ng模型,并且只有一个位置可以“显示”它,该怎么办。我想改为在“display”元素设置debounce

例如,如何使
名称
中缓慢显示,但在
输入之间快速同步

HTML

<!DOCTYPE html>
<html ng-app="plunker">

  <head>
    <meta charset="utf-8" />
    <title>AngularJS Plunker</title>
    <script>document.write('<base href="' + document.location + '" />');</script>
    <link rel="stylesheet" href="style.css" />
    <script data-require="angular.js@1.4.x" src="https://code.angularjs.org/1.4.1/angular.js" data-semver="1.4.1"></script>
    <script src="app.js"></script>
  </head>

  <body ng-controller="MainCtrl">
    <p ng-model-options="{ debounce: { 'default': 500 } }">Hello {{name}}!</p>
    <input ng-model="name" >
    <input ng-model="name">
  </body>

</html>
var app = angular.module('plunker', []);

app.controller('MainCtrl', function($scope) {
  $scope.name = 'World';
});