Im using ngImgCrop as can be seen in this JSFiddle.
What I try to achieve is that the image selection box will open automatically when i show(using ng-if) the:
<div ng-if="showImageSelector">
<div>Select an image file: <input type="file" id="fileInput" /></div>
<div class="cropArea">
<img-crop image="myImage" result-image="myCroppedImage"></img-crop>
</div>
</div>
that is: i want to programatically open the image selection window, without even showing the user the:
<input type="file" id="fileInput" />
Iv'e tried put in the controller several variations of click event of the input, but none of them worked, so far iv'e tried: 1.
$timeout(function() {
angular.element('#fileInput').triggerHandler('click');
}, 0);
2.
angular.element(document).ready(function () {
angular.element('#fileInput').triggerHandler('click');
});
3.
setTimeout(function(){
angular.element('#fileInput').triggerHandler('click');
}, 1000);
4.
setTimeout(function(){
document.getElementById('fileInput').click();
}, 1000);