var myApp = angular.module('spicyApp1', []);
myApp.controller('TestController', ['$scope', function($scope) {
$scope.spice = 'very';
$scope.clickButton = _.throttle(function() {
console.log(new Date());
}, 1000, {'trailing': false});
// $scope.clickButton = function() {
// console.log(new Date());
// };
}]);
<div ng-app="spicyApp1" ng-controller="TestController">
双击测试按钮只会在控制台输出一个时间,间隔一秒后点击才会输出第二个<br>
<button ng-click="clickButton()">测试</button>
</div>