0

Forms elements like checkboxes and radio buttons seem to not work with touch libraries like ng-touch. Any workaround or solutions for the same ?

ZenKid
  • 1
  • 3
  • why you want to use ng-touch,ur exact requirement?? – Ankit Kumar Gupta Mar 14 '17 at 13:53
  • I am creating a multi-touch app using HTML5- AngularJS, on a touch device on an OS that is neither android nor IOS, hence can't use compilers like phonegap. Also gestures like pinch and zoom are only working with ng-touch. – ZenKid Mar 14 '17 at 14:12

1 Answers1

0

You can create another directive that simulates a click event to replace ngTouch's ng-click version for that specific problem.

.directive('basicClick', function($parse, $rootScope) {
 return {
  compile: function(elem, attr) {
    var fn = $parse(attr.basicClick);
    return function(scope, elem) {
     elem.on('click', function(e) {
       fn(scope, {$event: e});
       scope.$apply();
      });
     };
    }
  };
});
Lotus91
  • 1,127
  • 4
  • 18
  • 31
  • The current version of ng-touch already has an ng-click very similar to this. Plus it is not so much with the click that the problem is. Even if the only operation is setting true or false value to a scope variable based on checkbox status using ng-model, the checkbox dosen't seem to work – ZenKid Mar 14 '17 at 14:51