froala / angular-froala

Angular.js bindings for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
MIT License
306 stars 123 forks source link

scope.froalaOptions is undefined #176

Closed jschendzielorz closed 5 years ago

jschendzielorz commented 6 years ago

I created a own directive wrapping a textarea with the frola attribute. In my directive i defined some options scope.options = { placeholderText: $attr.placeholder, toobarButtons: [ 'fullscreen', 'bold', 'italic', 'underline', 'strikeThrough', 'paragraphFormat', 'formatOL', 'formatUL', 'quote', 'insertLink','|', 'undo', 'redo', ], }; and pass them to the frola directive like this <textarea froala="options" ng-model="html"></textarea>.

The defined options take no effekt on the editor.

I did some debugging and found out that scope.froalaOptions is undefined in this line https://github.com/froala/angular-froala/blob/abd92b30097a7458929a0a822e54583cb5de64fd/src/angular-froala.js#L103

shashankaccolite commented 5 years ago

In the directive you have defined scope.options = { placeholderText: $attr.placeholder, toobarButtons: [ 'fullscreen', 'bold', 'italic', 'underline', 'strikeThrough', 'paragraphFormat', 'formatOL', 'formatUL', 'quote', 'insertLink','|', 'undo', 'redo', ], }; $attr should be defined first in your code else it will show error that $attr is not defined and that is the reason behind getting the error of scope.froalaOptions is undefined. If you remove the $attr.placeholder it will work fine.