angular.touch

发表于 angular 分类,标签:
;

angular.module(, [])
.directive(, () {
    {
        controller: [, , ($scope, $element) {

            $element.bind(, onTouchStart);
            onTouchStart(event) {
                method = $element.attr();
                $scope.$event = event;
                $scope.$apply(method);
            }

        }]
    }
})
.directive(, () {
    {
        controller: [, , ($scope, $element) {

            $element.bind(, onTouchStart);
            onTouchStart(event) {
                event.preventDefault();
                $element.bind(, onTouchMove);
                $element.bind(, onTouchEnd);
            }
            onTouchMove(event) {
                method = $element.attr();
                $scope.$event = event;
                $scope.$apply(method);
            }
            onTouchEnd(event) {
                event.preventDefault();
                $element.unbind(, onTouchMove);
                $element.unbind(, onTouchEnd);
            }

        }]
    }
})
.directive(, () {
    {
        controller: [, , ($scope, $element) {

            $element.bind(, onTouchEnd);
            onTouchEnd(event) {
                method = $element.attr();
                $scope.$event = event;
                $scope.$apply(method);
            }

        }]
    }
});

usage

var app = angular.module("demoapp", ["ngTouch"]);


<div ng-touchmove="someFunction($event)" ng-touchstart="someFunction($event)" ng-touchend="someFunction($event)"></div>




https://github.com/nglar/ngTouchmove/tree/master/src

0 篇评论

发表我的评论