Javascript 查看html格式的word文档/pdf,当前使用
尝试在我的HTML上查看文件,但在修复了消毒液问题后,似乎没有显示任何内容 这是我的Html:Javascript 查看html格式的word文档/pdf,当前使用,javascript,angular,Javascript,Angular,尝试在我的HTML上查看文件,但在修复了消毒液问题后,似乎没有显示任何内容 这是我的Html: 这是ts文件 public filePreview = ''; trustTwo = null;` this.trustTwo = sanitizer.bypassSecurityTrustResourceUrl(this.filePreview);` onFilePicked(event: Event) { const filePicked = (event.target as HTM
这是ts文件
public filePreview = '';
trustTwo = null;`
this.trustTwo = sanitizer.bypassSecurityTrustResourceUrl(this.filePreview);`
onFilePicked(event: Event) {
const filePicked = (event.target as HTMLInputElement).files[0];
this.form.patchValue({ file: filePicked });
this.form.get('file').updateValueAndValidity();
const reader = new FileReader();
reader.onload = () => {
this.filePreview = reader.result;
};
reader.readAsDataURL(filePicked);
}
任何人都可以告诉我正确的方向,目前文件上传到服务器,但我正在尝试在HTML上显示文件。如果这是一种完全错误的方式,请提出任何替代方案。我看到了可能的重复,但它不起作用,因此询问是否有人有其他建议?