Description
In a normal scenario where you go from edit mode to presentation mode and then back to edit mode, the second time you go to edit mode by using ng-if. You will get an
Converting circular structure to JSON
--> starting at object with constructor 'Window'
--- property 'parent' closes the circle
error showing in the console, this is because the options used to create a new froala editor the second time around has a reference to the previous editor create in the ctrl.options.froalaEditor.
To fix it it must be cleared when the editor is destroyed on initialized.
Then you might experience the next issue which is element is null when reaching element.bind('$destroy'
to work around this issue pass the element as an argument to the ctrl.initListeners function and it seems to be working.
And also found, one reason why froala has bad performance is most likely because of the lack of cleanup when the controller is destroyed. Second time the controller is initlized the ctrl.options.events.initialized
is called twice, third time three times etc.
I would say that angular-froala is not production ready and should be used with care until these basic issues have been solved.