I can't take credit for writing this code, found it on http://stackoverflow.com/questions/11997246/bind-ckeditor-value-to-model-text-in-angularjs-and-rails/12021632#12021632
angular.module('yourApp').directive('ckEditor',function () { return { require: '?ngModel', link: function (scope, elm, attr, ngModel) { var ck = CKEDITOR.replace(elm[0], { toolbarGroups: [ { name: 'clipboard', groups: ['clipboard', 'undo'] }, { name: 'basicstyles', groups: ['basicstyles', 'cleanup'] } ] } ); if (!ngModel) return; ck.on('pasteState', function () { scope.$apply(function () { ngModel.$setViewValue(ck.getData()); }); }); ngModel.$render = function (value) { ck.setData(ngModel.$viewValue); }; } }; });
Nice! This post is really useful for me and everyone. Thanks for sharing the awesome list. ROR Development Company
ReplyDeleteReally this code is very useful for developing CMS using Angular.JS
ReplyDeleteAngularjs Training in Chennai
Really this code is very useful for developing CMS using Angular.JS
ReplyDeleteAngularjs Training in Chennai
Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!
ReplyDeleteOffshore Angularjs Developers