Im using tinyMCe
for my project.Everything is working fine but now i want to restrict the number of character that will be insert into tinyMce
text
Here's how you can limit max number of characters on frontend using ng-maxlength directive from AngularJS.
Param :
ngMaxlength
Type : number
Details : Setsmaxlength
validation error key if the value is longer than maxlength.
Please note that this directive doesn't just count the displayed text characters, it counts all the text inside in HTML like tags and scripts.
First of all, include AngularJS, TinyMCE 4 distributive, and AngularUI wrapper for TinyMCE.
HTML:
JavaScript:
angular.module('myApp', ['ui.tinymce'])
.config(['$sceProvider', function($sceProvider) {
// Disable Strict Contextual Escaping
$sceProvider.enabled(false);
}])
.constant('uiTinymceConfig', {/*...*/})
.controller('myCtrl', ['$scope', function($scope) {
// ...
}]);
jsFiddle
Read the manual before using this solution to fully understand consequences of disabling SCE in AngularJS: $sce service.