sebastianha / angular-bootstrap-checkbox

A checkbox for AngularJS styled to fit the Twitter Bootstrap standard design
MIT License
148 stars 66 forks source link

Mobile browser support #20

Open hitchcockwill opened 9 years ago

hitchcockwill commented 9 years ago

Checkbox does not register a click on mobile Safari or Chrome. Any suggestions for a workaround for this?

Update: Just did some more digging. It looks like the click event that is bound in the directive is not properly binding on mobile. Note that my app does have ngTouch included.

elem.bind("click", function() {
  console.log('This was clicked') // This never gets logged on mobile
  scope.$apply(function() {
    if(modelCtrl.$modelValue === falseValue) {
      modelCtrl.$setViewValue(trueValue);
    } else {
      modelCtrl.$setViewValue(falseValue);
    }
  });
});
sebastianha commented 9 years ago

Thanks for reporting, I will test this as soon I get my hands on a mobile device.

hitchcockwill commented 9 years ago

Submitted a pull request for this issue: https://github.com/sebastianha/angular-bootstrap-checkbox/pull/22