angularjs - multiple textareas using angular ui-tinymce not displaying when using two controllers -
i using ui-tinymce angular 1.5 , using in 2 different locations on page coming 2 separate controllers. work on 1 textarea @ at time.
if move both textareas same controller display correctly. or if delete 1 textarea other displays. there special needed make ui-tinymce work 2 controllers on 1 page? injecting ui-tincymce both controllers.
thank
i ran same issue , determined reason because directive starts id numbering @ 0 each controller. (see var generatedids = 0
in angular.tinymce.js on or around line 8). more under-the-hood knowledge of angular explain why directive "resets" every controller, root issue directive reusing ids. fix came modify angular.tinymce.js replace:
attrs.$set('id', id_attr + '-' + generatedids++);
with
attrs.$set('id', id_attr + '-' + string(new date().gettime());
it's not ideal fixed issue immediately. gettime() milliseconds since jan 1 1970, counts quite rapidly (meaning, chances of collision extremely slim). combine + string(math.round(math.random() * 100000))
if you're paranoid javascript might run fast enough (or threaded enough, someday) initialize 2 tinymce editors on same millisecond.
Comments
Post a Comment