Angular + CKEditor 4.2
HTML
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<script src="http://ckeditor.com/apps/ckeditor/4.2/ckeditor.js"></script>
<script src="http://code.angularjs.org/1.1.5/angular.min.js"></script>
<div data-ng-app="app" data-ng-controller="myCtrl">
<h3>CKEditor 4.2:</h3>
<div ng-repeat="editor in ckEditors">
<textarea data-ng-model="editor.value" data-ck-editor></textarea>
<br />
</div>
<button ng-click="addEditor()">New Editor</button>
</div>
JavaScript
var app = angular.module('app', []);
app.directive('ckEditor', [function () {
return {
require: '?ngModel',
link: function ($scope, elm, attr, ngModel) {
var ck = CKEDITOR.replace(elm[0]);
ck.on('pasteState', function () {
$scope.$apply(function () {
ngModel.$setViewValue(ck.getData());
});
});
ngModel.$render = function (value) {
ck.setData(ngModel.$modelValue);
};
}
};
}])
function myCtrl($scope){
$scope.ckEditors = [];
$scope.addEditor = function(){
var rand = ""+(Math.random() * 10000);
$scope.ckEditors.push({value:rand});
}
}