I wonder how I can trigger a click from within an angularjs/1.6.4 directive.
Basically this code works partially:
app.directive('abc', function() {
return {
:
:
link: function(scope, element, attrs, controller) {
:
setTimeout(function(){element[0].click();}, 400);
:
}
}
});
However the problem is if the page takes longer than 400ms to load. In this case it does not work. Therefore I would prefer a solution that didn't depend on a specified timeout period but a method that worked no matter how long the page took to load.