简体   繁体   English

如何在角度应用程序中从 Tinymce 上传文件?

[英]How to upload a file from Tinymce in a angular application?

I've started a project using Angular 4, together with Material Design.我已经使用 Angular 4 和 Material Design 开始了一个项目。 In the project I would like to use TinyMce 4 to be able to write "news".在项目中我想用TinyMce 4 来写“新闻”。

I have tried to follow this example https://www.tinymce.com/docs/demo/file-picker/ but gets a error on line reading我试图按照这个例子https://www.tinymce.com/docs/demo/file-picker/但在线阅读时出错

const file = this.files[0];

The error looks like:错误看起来像:

 Property 'files' does not exist on type 'HTMLElement'

I am new to javascript so I really would appreciate some help.我是 javascript 新手,所以我真的很感激一些帮助。

//lg //lg

Finally found the problem.终于找到问题了。

const file = this.files[0];

should be应该

const file = input.files[0];

I don't know why it works in the example mentioned above,, but this change made it for me.我不知道为什么它在上面提到的例子中有效,但这个改变对我来说是成功的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM