Search code examples
angularjsangularjs-ng-touchui.bootstrap

Disable ng-touch on on specific location


I am using carousel from ui.bootstrap and for that i need to use ng-touch. When i inject my app with ngTouch it brakes some things, inputs in mobile can't be clicked. How can i inject specific controller, i have tried to make two different modules but i have to load the module with ngTouch inside ng-app module and again that brakes things.

angular.module('appModule',['carouselModule'])
angular.module('carouselModule',['ngTouch','ui.bootstrap'])

Solution

  • With the guide of @estus, i have found the solution.

    directives.stopEvent=function() {
        return {
            restrict: 'A',
            link: function(scope, element, attr) {
                element.on(attr.stopEvent, function(e) {
                    e.stopPropagation();
                });
            }
        };
    }
    

    and in the html for example:

    <div id="topbar" stop-event="touchend">...</div>