Skip to content Skip to sidebar Skip to footer

Angularjs Doesn't Trigger Event Handled By Addeventlistener

Solution 1:

Angular uses jqLite internally. If you load jQuery before Angular it will use jQuery instead of jqLite.

triggerHandler only triggers events that are added by jqLite/jQuery.

To trigger events added by addEventListener you need to use the standard API.

For example:

var el = document.getElementById('zero');
el.click();

Or:

var el = document.getElementById('zero');
el.dispatchEvent(newEvent('click'));

If you need to support older browsers you can start by reading here.

Post a Comment for "Angularjs Doesn't Trigger Event Handled By Addeventlistener"