I have a parent component in which I have 2 input type="file"
elements which call the function getFileForParent()
on file change :
<input type="file" (change)="getFileForParent()" />
And in my child component I have one :
<input type="file" (change)="getFileForChild()" />
but whenever I select a file on the child component the parents getFileForParent
is called.
I am using ng2-file-upload
.
Parent ts:
getFileForParent(){
if(this.uploaderForParent.queue[0].file.type != 'application/PDF'){
this.showError("Please select pdf files only");
return;
}
this.uploaderForParent.uploadAll();
}
Child ts:
getFileForChild(){
if(this.uploaderForChild.queue[0].file.type != 'application/PDF'){
this.showError("Please select pdf files only");
return;
}
this.uploaderForChild.uploadAll();
}