Lost "this" In Callback From Tinymce
I have an angular2 app with tinyMce as a HTML editor. The only problem is, I need to convert the URLs in the html through my REST API. To do that I attempted to use 'urlconverter_c
Solution 1:
You can try one of these options:
1) use bind
within tinymce.init
urlconverter_callback: this.urlConverter.bind(this)
or within constructor:
constuctor() {
this.urlConverter = this.urlConverter.bind(this);
}
2) use arrow function on the urlConverter
method
urlConverter = (url, node, on_save): string => {
...
}
or within tinymce.init
urlconverter_callback: (url, node, on_save) => this.urlConverter(url, node, on_save)
Post a Comment for "Lost "this" In Callback From Tinymce"