Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Element trigger click event doesn't work with ionic

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

like image 260
Thusithz Avatar asked Oct 29 '22 20:10

Thusithz


1 Answers

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');

});
like image 126
RIYAJ KHAN Avatar answered Nov 11 '22 03:11

RIYAJ KHAN