Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/471.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 查看html格式的word文档/pdf,当前使用_Javascript_Angular - Fatal编程技术网

Javascript 查看html格式的word文档/pdf,当前使用

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

尝试在我的HTML上查看文件,但在修复了消毒液问题后,似乎没有显示任何内容

这是我的Html:

这是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上显示文件。如果这是一种完全错误的方式,请提出任何替代方案。

我看到了可能的重复,但它不起作用,因此询问是否有人有其他建议?