I am displaying a CK editor on uibmodal window using angular js.
<div>
<textarea ckeditor="editorOptions" id="ckID" ng-model="content"></textarea>
</div>
I want to insert a piece of text in the CK Editor on click of a button named 'insertDynamicContent1' and am using the below;
$scope.insertDynamicContent1 = function(str) {
CKEDITOR.instances[ckID].insertText(str);
};
I am getting the following error-
angular.js:11607 TypeError: Cannot read property 'insertText' of
undefined
at l.$scope.insertDynamicContent1 (templates-controller.js:191)
at angular.js:12345
at f (angular.js:21438)
at l.$eval (angular.js:14401)
at l.$apply (angular.js:14500)
at HTMLButtonElement.<anonymous> (angular.js:21443)
at HTMLButtonElement.c (angular.js:3014)
I went through stack posts How to use CKEditor in a Bootstrap Modal? that specifies to modify the z-index value for CK editor or the model window, so i did the below;
//added it to ck-ediotr's config.js
config.baseFloatZIndex = 20000;
//added it to the css to modify the model class
.custom-dialog .modal-dialog {
z-index: 10000 !important;
width: 90%;
top: 30%;
}
I am still facing the same error and i have no clue on what is going on. Any help would be appreciated.
Thank You!