如何在angularjs中快速使用kindeditor富文本编辑器 ?
-
先引入相关的css样式和js文件:
<!-- 富文本编辑器 --> <link rel="stylesheet" href="../plugins/kindeditor/themes/default/default.css" /> <script charset="utf-8" src="../plugins/kindeditor/kindeditor-min.js"></script> <script charset="utf-8" src="../plugins/kindeditor/lang/zh_CN.js"></script>
-
在页面中写入文本域:
<textarea name="content" style="width:800px;height:400px;visibility:hidden;"></textarea>
-
js代码:
<!-- 正文区域 /--> <script type="text/javascript"> var editor; KindEditor.ready(function (K) { editor = K.create('textarea[name="content"]', { allowFileManager: true }); }); </script>
页面controller.js中就可以使用editor.html()获取富文本编辑器中的内容;