Skip to content

Instantly share code, notes, and snippets.

@sudeepdk
Forked from anonymous/index.html
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudeepdk/a21b63f6f4e66d53e2aa to your computer and use it in GitHub Desktop.
Save sudeepdk/a21b63f6f4e66d53e2aa to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<div ng-controller="CkCtrl">
<textarea name="editor" id="" cols="30" rows="10" ng-model="editorData"></textarea>
<pre>
{{ editorData }}
</pre>
</div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/ckeditor/4.0.1/ckeditor.js"></script>
<script>
CKEDITOR.replace( 'editor' );
</script>
<script id="jsbin-javascript">
function CkCtrl($scope) {
// Load initial data, doesn't matter where this comes from. Could be a service
$scope.editorData = '<h1>This is the initial data.</h1>';
var editor = CKEDITOR.instances.editor;
// When data changes inside the CKEditor instance, update the scope variable
editor.on('instanceReady', function (e) {
this.document.on("keyup", function () {
$scope.$apply(function () {
$scope.editorData = editor.getData();
});
});
});
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">function CkCtrl($scope) {
// Load initial data, doesn't matter where this comes from. Could be a service
$scope.editorData = '<h1>This is the initial data.</h1>';
var editor = CKEDITOR.instances.editor;
// When data changes inside the CKEditor instance, update the scope variable
editor.on('instanceReady', function (e) {
this.document.on("keyup", function () {
$scope.$apply(function () {
$scope.editorData = editor.getData();
});
});
});
}</script></body>
</html>
function CkCtrl($scope) {
// Load initial data, doesn't matter where this comes from. Could be a service
$scope.editorData = '<h1>This is the initial data.</h1>';
var editor = CKEDITOR.instances.editor;
// When data changes inside the CKEditor instance, update the scope variable
editor.on('instanceReady', function (e) {
this.document.on("keyup", function () {
$scope.$apply(function () {
$scope.editorData = editor.getData();
});
});
});
}
@sudeepdk
Copy link
Author

sudeepdk commented Dec 9, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment