I have a big problem in safari when i try to fire click event on an input file, after and inside a change event (onchange, ng-change, $ scope.watch ... etc, i tried all). this works fine in chrome, explorer, but not in SAFARI. Here is an example of my code, with two forms to fire click:
$scope.mialerta = function(event) {
$timeout(function() {
alert("alerta");
//solution one
var evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true);
document.getElementById('file_documents_first').dispatchEvent(evt);
//solution two angular.element(document.querySelector('#file_documents_first')).trigger('click');
});
};
<select name="cedula" id="cedula" class="form-control col-md-8"
ng-model="cedula"
ng-change="mialerta()"
ng-options="option.id as option.name for option in options" ></select>
<input type="file" id="file_documents_first" name="file_documents_first" accept=".jpg,.jpeg,.pdf" ng-model="file_documents_first" >