[英]Angular error in P-fileupload when ng build --prod
In my Angular project, when I try to run ng build --prod
, I have this issue in the p-fileUpload
from primeng : 在我的Angular项目中,当我尝试运行ng build --prod
,我在primeng的p-fileUpload
中遇到了这个问题:
media.component.html
(5,81): Supplied parameters do not match any signature of call targetmedia.component.html
(5,81):提供的参数与调用目标的任何签名都不匹配
But if I use the ng build
without --prod
, it builds normally. 但是,如果我使用不带--prod
的ng build
,它将正常构建。 Same if I use ng serve
. 如果我使用ng serve
。
This is the code: 这是代码:
<p-fileUpload mode="basic" #fileInput name="files" url="{{url}}" auto="auto" (onBeforeUpload)="onBeforeUpload($event)" chooseLabel="Allega file"
(onUpload)="onUpload($event)" (onProgress)="onProgress($event)" (onError)="onError($event)" multiple="multiple" (onBeforeSend)="onBeforeSend($event)"
accept="{{uploadAcceptedFormat}}" maxFileSize="{{maxUploadSize}}"></p-fileUpload>
And this is the method: 这是方法:
onError(event: any) {
this.showProgressBar = false;
console.log(event);
this.openSnackBar('Upload fallito')
}
onBeforeSend(event) {
event.xhr.setRequestHeader('Authorization', 'Bearer ' + localStorage.getItem('token'));
this.showProgressBar = true;
}
onUpload(event) {
this.openSnackBar('Upload completato')
this.progressValue = 0;
this.showProgressBar = false;
this.reloadMedias();
}
onBeforeUpload(event) {}
onProgress(event) {
if (event.originalEvent.loaded !== 0) {
this.progressValue = (event.originalEvent.loaded / event.originalEvent.total) * 100;
}
}
Like all other methods in the fileupload I have 1 event, so why this give me errors only with --prod
像fileupload中的所有其他方法一样,我有1个事件,所以为什么这只给我--prod
错误
由于某种原因,如果我删除onBeforeUpload(event) {}
方法,它将正常工作并正常构建
尝试使用以下命令进行构建:
ng build --prod --aot=false;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.