when I\'m trying to install \"npm install ng2-file-upload --save\" in my angular 4 application it throws
UNMET PEER DEPENDENCY @4.1.0
UNMET PEER DEPENDENCY
HTML:
TS:
@Component({
......
})
export class myComponent{
form: FormGroup;
contructor(fb: FormGroup){
form: fb.group({file: null});
}
//fVals comes from HTML Form -> (ngSubmit)="postImage(form.value)"
postImage(fVals){
let body = new FormData();
body.append('file', formValues.file);
let httpRequest = httpclient.post(url, body);
httpRequest.subscribe((response) =>{
//..... handle response here
},(error) => {
//.....handle errors here
});
}
onFileChange(event) {
if(event.target.files.length > 0) {
let file = event.target.files[0];
this.form.get('file').setValue(file);
}
}
}