AngularJS:ngMobile仍有300毫秒的延迟

时间:2013-10-28 14:58:10

标签: angularjs cordova touch

我使用Phonegap 3.0和AngularJS 1.1.5。

我想删除触摸设备上300ms的延迟。因此我整合了angular-mobile(见v1.1.5 angular-mobile.js)。 在我的app.js中我有

var myApp = angular.module('myApp', ['ajoslin.mobile-navigate', 'ngMobile'])
.config(function ($compileProvider) {
    $compileProvider.urlSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|tel):/);
})
.config(['$routeProvider', function ($routeProvider) {
    $routeProvider.when('/', {templateUrl: 'partials/homeView.html', controller: 'HomeCtrl'});
    $routeProvider.otherwise({redirectTo: '/'});
}]);

在我的部分:

<a ng-click="showTime()" >Alert</a>

我的控制器:

function HomeCtrl($scope, $rootScope, $navigate) {
  $scope.showTime = function () {
       console.log(Date.now());
   };
}

文本已打印,但您看到它延迟了300毫秒,因为它现在不会出现在日志中。

任何人都可以帮助我吗?

也许我做错了什么; - )

谢谢!

2 个答案:

答案 0 :(得分:1)

答案 1 :(得分:1)

我切换到AngularJS 1.2并使用角度代码中的ngTouch指令!那很有效!

相关问题