在jquery

时间:2017-09-04 08:50:08

标签: javascript jquery angular froala

按照this related question中的Asad示例,我不知道如何引用javascript本身和角度变量的对象。

// 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>');
                        }
                      });

0 个答案:

没有答案