Created
December 9, 2014 15:45
-
-
Save anonymous/a2e30226817d3bed2380 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/iMoQuPe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/questions/19088322/how-to-display-dynamic-content-into-ck-editor-using-angular-js