我从 froala 编辑器(Angular io)将图像上传到 S3,现在我想将该链接存储在一个变量中。我该怎么做?下面是我如何尝试
export class WriterComponent implements OnInit {
imageLink:string;
constructor() { }
ngOnInit() {
this._usersService.getS3Hash().subscribe(resp=>{
this.options['imageUploadToS3'] = resp;
});
}
public options:Object={
heightMin:300,
events:{
'froalaEditor.image.uploadedToS3': function (e,editor,link,key,response) {
// save the link
this.imageLink=link;
}
}
HTML文件中的froala编辑器
<textarea [froalaEditor]="options" ngModel name="inputcontent"></textarea>
但是在上传图像后,当我显示imageLink时它显示为空。
这似乎是上下文问题,因为imageLink使用的是 froala 编辑器上下文而不是组件。