标签:code select hang mode paste class elm module end
var cmsPlus = angular.module(‘cmsPlus‘, []); cmsPlus.directive(‘ckEditor‘, function() { return { require: ‘?ngModel‘, link: function(scope, elm, attr, ngModel) { var ck = CKEDITOR.replace(elm[0]); if (!ngModel) return; ck.on(‘instanceReady‘, function() { ck.setData(ngModel.$viewValue); }); function updateModel() { scope.$apply(function() { ngModel.$setViewValue(ck.getData()); }); } ck.on(‘change‘, updateModel); ck.on(‘key‘, updateModel); ck.on(‘dataReady‘, updateModel); ck.on(‘paste‘, updateModel); ck.on(‘selectionChange‘, updateModel); ngModel.$render = function(value) { ck.setData(ngModel.$viewValue); }; } }; });
标签:code select hang mode paste class elm module end
原文地址:http://www.cnblogs.com/li-you/p/5997130.html