以下代码假设使用 AnguarUI 的 Event 指令来传递 HammerJS 事件,但它不起作用。我显然错过了一些东西,但不明白到底是什么。没有抛出任何错误。
<!doctype html>
<html ng-app="myapp" charset="UTF-8">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>
<script type="text/javascript" src="https://raw.github.com/angular-ui/ui-utils/master/modules/event/event.js"></script>
<script type="text/javascript" src="https://raw.github.com/EightMedia/hammer.js/v1.0.5/dist/hammer.min.js"></script>
<style type="text/css">
div {
width: 100%;
height: 100%;
}
</style>
</head>
<body ng-controller="pageCtrl">
<div ui-event="{ tap: 'tapCallback()' }"></div>
<script type="text/javascript">
angular.module('myapp', ['ui.event']);
function pageCtrl($scope) {
$scope.tapCallback = function() {
alert("test");
}
}
</script>
</body>
</html>