javascriptangularjswysiwygtrumbowyg

Clearing the trumbowyg editor in angular


I am currently using the trumbowyg editor on a project and I am having a problems clearing the contents of the editor. Every thing is fine if I want to re-populate the editor by changing the contents of the model attached to it but it will not clear the contents of the editor when I do $scope.editorModel = '';. I have a Plunker here that explains it a bit more (click the button at the bottom of the page).

Anyone got any ideas?


Solution

  • I found that newer versions of Trumbowyg (2.4.2) and trumbowyg-ng have good two-way binding on the model.

    So, now when the model is directly set to '', both the model and the trumbowyg editor blank out.

    <pre>editorModel: {{editorModel}}</pre>
    <textarea trumbowyg-ng ng-model="editorModel"></textarea>
    

    See this at work here: http://plnkr.co/edit/FoCUDI?p=preview