5

I need to pass a click event from the controller so I used this code:

angular.element(document.querySelectorAll('#cal')).triggerHandler('click');

In my browser it works when put ionic serve but it didn't work on mobile

2
  • 3
    triggerHandler is available to 1.3 onwards.below it use 'trigger' Commented Sep 7, 2016 at 13:05
  • but it does n't work Commented Sep 8, 2016 at 4:36

1 Answer 1

2

You can write in this way in your controller.

angular.element(document).ready(function () {

        angular.element(document.querySelectorAll('#cal')).triggerHandler('click');

        //OR

        angular.element(document.querySelectorAll('#cal')).trigger('click');

});
Sign up to request clarification or add additional context in comments.

1 Comment

angular.element(document.querySelectorAll('#cal')).triggerHandler('click'); this also work in some devices case is gamsung device thanks for your answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.