I want to share the code snippet I am working on:
.jade:
div(layout="row")
div(layout="column", flex)
label(style="margin-left: 5px") File
md-button(class="md-raised", ng-click="onUploadClicked(3)") Upload
input(id="image3", type="file", accept=".pdf", file-upload="uploadFile”, style="display: none;")
.js/controller:
$scope.uploadFile = function(file) {
console.log("upload file");
}
$scope.onUploadImageClicked = function(position) {
console.log("on upload image");
$timeout(function() {
document.querySelector('#image' + (position)).click();
}, 100);
};
The issue I am facing is that the log message upload file
gets printed twice, while the message on upload image
only prints once when I click the Upload
button, select a file from the chooser, and press Open.
What could possibly be causing this double firing of the upload file message in my code?
Update:
I attempted to use event.stopPropagation(), but it did not solve the problem.
In my javascript files, I have included just the angular.min.js one.