ui-tinymce
ui-tinymce copied to clipboard
Instantiate Tinymce event if id is generated with angular expression in ngRepeat
For dynamically created editors (e.g. with ngRepeat) the unique id that is generated and set to the element during linking may be overwritten, if the id is generated with an angular expression, so we have to overwrite it again.
Otherwise tinymce won't be initialized.
Here's an example:
<div ng-repeat="item in collection">
<textarea id="foo_{{ $index }}"
name="foo_{{ $index }}"
ui-tinymce="{{ some_config }}"
ng-model="item.foo">
</textarea>
</div>
During linking of uiTinymce the id is set to something like "ui-tinymce-3". But then it replaced to something like "foo_2" and in tinymce.init() it won't find the element, because it uses the selector "#ui-tinymce-3".