使用方法看注释。主要解决帮上ngModel的问题

  1. angular.module('newApp')
  2. .directive('ckeEditor', function() {
  3. return {
  4. /*
  5. For Example:
  6. <textarea id="..." name="..." class="form-control" cke-editor
  7. rows="10" cols="80" ng-model="..."></textarea>
  8. */
  9. restrict: 'A',
  10. require: '?ngModel',
  11. link: function(scope, element, attrs, ngModel) {
  12. var ckeditor = CKEDITOR.replace(element[0], {
  13. toolbar :[
  14. ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'],
  15. ['Link','Unlink','Anchor'],
  16. ['Image', 'Table', 'HorizontalRule', 'SpecialChar'],
  17. ['Source'],
  18. ['Bold', 'Italic', 'Strike','-', 'RemoveFormat'],
  19. ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote'],
  20. ['Format'],
  21. ['Styles']
  22. ]
  23. });
  24. ckeditor.on('instanceReady', function() {
  25. ckeditor.setData(ngModel.$viewValue);
  26. });
  27. ckeditor.on('pasteState', function() {
  28. scope.$apply(function() {
  29. ngModel.$setViewValue(ckeditor.getData());
  30. });
  31. });
  32. ngModel.$render = function(value) {
  33. ckeditor.setData(ngModel.$viewValue);
  34. }
  35. }
  36. }
  37. })

Angularjs中添加ckEditor插件的更多相关文章

  1. atitit.MyEclipse10 中添加svn插件故障排除

    atitit.MyEclipse10 中添加svn插件故障排除 删除\configuration \org.eclipse.update 不行... 二. 在configuration下的config ...

  2. 在多个浏览器中添加IDM插件

    许多朋友下载了IDM(Internet Download Manager)不知如何使用.把包含视频的链接放到软件新建任务,下载下来的的却是网页而不是视频.该软件下载视频的其中一个方法,需安装浏览器插件 ...

  3. 关于在eclipse中添加windowbuilder插件的问题

    最近在学习GUI,发现我的Eclipse中没有windowbuilder插件,之后按照百度搜索,按照网上教程,去安装时,发现下载网页已经更新,造成了很多问题, 不过问题不大,我已经找到了解决方法: 安 ...

  4. Angularjs中添加HighCharts

    一. 添加基本配置 1. 添加指令 angular.module('newApp') .directive('dpHighchart', ['$rootScope', function($rootSc ...

  5. ECLIPSE中添加TPTP插件

    转自:http://blog.csdn.net/sinboy/article/details/1536625 程序在实际应用当中,大数据量时对系统本身的影响是一个不得不面对的问题. 最早在使用Jbui ...

  6. eclipse中添加aptana插件(html.css.js自动提示)

    一.关于aptana aptana是一款很不错的插件,本人主要用于安装此类插件,在eclipse中用于编辑javascript代码,html代码,和css代码的,因为其有自动纠错功能,当然安装后的问题 ...

  7. Myeclipse中添加XFire插件支持

    自Myeclipse7.5后貌似默认不启用XFire插件的集成  本人今天使用Myeclipse10.6是发现没有XFire 自己捣鼓捣鼓 已经成功添加XFire 添加步骤 1.打开Myeclipse ...

  8. 怎么在Eclipse中添加VI插件

    下载地址 Vi插件下载位置 怎么安装? 将下载下来的zip文件进行解压,然后把对于的目录下的文件分别复制到eclipse目录下的plugins 和features目录下: 注册 在eclipse根目录 ...

  9. eclipse中添加svn插件

    在eclipse中使用svn查看能非常方便的对代码进行查看和更新提交操作,能及时知道代码的更新状态. 在eclipse中如果要使用svn,只能使用svn插件的方式进行. 插件地址:http://sub ...

随机推荐

  1. 【SpringMVC框架】非注解的处理器映射器和适配器

    参考来源:     http://blog.csdn.net/acmman/article/details/46968939 处理器映射器就是根据URL来找Handler,处理器适配器就是按照它要求的 ...

  2. Spring.Net学习笔记(2)-依赖注入

    一.开发环境 操作系统:Win10 编译器:VS2013 framework版本:.net 4.5 Spring版本:1.3.1 二.涉及程序集 Spring.Core.dll Common.Logg ...

  3. ajax怎么理解?

    Ajix是创建交互式网页的前端网页开发技术,不是一种语言,ajax是基于http来传输数据的,他是利用浏览器提供操作http的接口(XMLHttpRequest或者activeXobject),来操作 ...

  4. python 关于一个懒惰和非懒惰的

    >>> pa = re.compile(r'<.*>') >>> result = pa.findall('<H1>title</H1 ...

  5. Python 将中文转拼音

    文字转拼音 import os.path class PinYin(object): def __init__(self): self.word_dict = {} def load_word(sel ...

  6. Windows下80端口被进程System&PID=4占用的解决方法

    我的占用原因是 SQL Server Reporting Services,停止掉这个服务并设置其为手动启动即可 如果你并没有安装 SQL Server,请参考下文解决 =============== ...

  7. POJ_2255_Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12342   Accepted: 7712 De ...

  8. 01C++编辑编译运行环境

    C++编辑编译运行环境 Bloodshed Dev-C++ Microsoft Visual Studio

  9. Eigen库笔记整理(二)

    Eigen/Geometry 模块提供了各种旋转和平移的表示 旋转矩阵直接使用 Matrix3d 或 Matrix3f Eigen::Matrix3d rotation_matrix = Eigen: ...

  10. PHP 加密:Password Hashing API

    PHP 5.5 之后引入 Password hashing API 用于创建和校验哈希密码,它属于内核自带,无需进行任何扩展安装和配置.它主要提供了四个函数以供使用: password_hash(): ...