Following the example of Asad in this related question, I do not know how to refer to the object this of the javascript itself and angular varibale.
// Original code, the angular variable don't work
$.FroalaEditor.RegisterCommand('insert', {
title: 'Insert Read More',
focus: true,
undo: true,
refreshAfterCallback: true,
callback: function () {
this.html.insert('<span class="readMore">'+this.angularVariable+' </span>');
}
});
// using fat arrows, the angular variable works but this.html.insert fails
$.FroalaEditor.RegisterCommand('insert', {
title: 'Insert Read More',
focus: true,
undo: true,
refreshAfterCallback: true,
callback: () => {
this.html.insert('<span class="readMore">'+this.angularVariable+' </span>');
}
});