javascript - Initialize tinymce in angular jS function throws the error second time -
initialize tinymce editor in angular js init function passing textarea id dynamically
html content below.
<div ng-app="rootapp" ng-controller="rootcontroller"> <div id="div1"> ---first content-------- <div ng-controller="editorcontroller" ng-init="getinformation('settingsduplicates')"> <textarea id=" settingsduplicates"></textarea> </div> </div> <div id="div2"> ---first content-------- <div ng-controller="editorcontroller" ng-init="getinformation('new1')"> <textarea id=" new1"></textarea> </div> </div> </div>
controller.js function
$scope.getinformation = function (from) { tinymce.editors = []; tinymce.init({ mode: "specific_textareas", selector: "textarea#" + from, height: 300, menubar: false, plugins: [ 'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker', 'searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking', 'save table contextmenu directionality emoticons template paste textcolor' ], theme: 'modern', toolbar1: 'bold italic | underline | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', image_advtab: true, templates: [ { title: 'test template 1', content: 'test 1' }, { title: 'test template 2', content: 'test 2' } ] }); //} $scope.screenfrom = from; //some service call }
first textarea converted editor i.e.fine. second textarea not converted editor throwing below issue
typeerror: cannot read property 'childnodes' of undefined @ g (angular.min.js:58)
Comments
Post a Comment