<script src="//cdn.ckeditor.com/4.6.1/standard/ckeditor.js"></script>
<script src="//cdn.ckeditor.com/4.5.7/standard/adapters/jquery.js"></script>
<script>
var app = angular.module("yourAppName", []);
app.directive('ckeditor', function ($sce) {
return {
require: 'ngModel',
link: function (scope, element, attr, ngModel) {
var editorOptions;
if (attr.ckeditor === 'minimal') {
// minimal editor
editorOptions = {
height: 100,
toolbar: [
{name: 'basic', items: ['Bold', 'Italic', 'Underline']},
{name: 'links', items: ['Link', 'Unlink']},
{name: 'tools', items: ['Maximize']},
{name: 'document', items: ['Source']},
],
removePlugins: 'elementspath',
resize_enabled: false
};
} else {
// regular editor
editorOptions = {
removeButtons: 'About,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Save,CreateDiv,Language,BidiLtr,BidiRtl,Flash,Iframe,addFile,Styles',
};
}
// enable ckeditor
var ckeditor = element.ckeditor(editorOptions);
// update ngModel on change
ckeditor.editor.on('change', function () {
ngModel.$setViewValue(this.getData());
});
}
};
});
app.controller("myCtrl",function($scope){
$scope.oveview = "<h1>Heading</h1><p>This is HTML Content</p>";
});
</script>
<div ng-controller="myCtrl">
<textarea name="overview" ng-model="oveview" ckeditor></textarea>
</div>
<script src="//cdn.ckeditor.com/4.5.7/standard/adapters/jquery.js"></script>
<script>
var app = angular.module("yourAppName", []);
app.directive('ckeditor', function ($sce) {
return {
require: 'ngModel',
link: function (scope, element, attr, ngModel) {
var editorOptions;
if (attr.ckeditor === 'minimal') {
// minimal editor
editorOptions = {
height: 100,
toolbar: [
{name: 'basic', items: ['Bold', 'Italic', 'Underline']},
{name: 'links', items: ['Link', 'Unlink']},
{name: 'tools', items: ['Maximize']},
{name: 'document', items: ['Source']},
],
removePlugins: 'elementspath',
resize_enabled: false
};
} else {
// regular editor
editorOptions = {
removeButtons: 'About,Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,Save,CreateDiv,Language,BidiLtr,BidiRtl,Flash,Iframe,addFile,Styles',
};
}
// enable ckeditor
var ckeditor = element.ckeditor(editorOptions);
// update ngModel on change
ckeditor.editor.on('change', function () {
ngModel.$setViewValue(this.getData());
});
}
};
});
app.controller("myCtrl",function($scope){
$scope.oveview = "<h1>Heading</h1><p>This is HTML Content</p>";
});
</script>
<div ng-controller="myCtrl">
<textarea name="overview" ng-model="oveview" ckeditor></textarea>
</div>
0 comments:
Post a Comment