Skip to content

Instantly share code, notes, and snippets.

@paprikka
Created February 20, 2013 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paprikka/5000011 to your computer and use it in GitHub Desktop.
Save paprikka/5000011 to your computer and use it in GitHub Desktop.
CKEDITOR directive for angularJS + CoffeeScript
angular.module('app.directives.ckeditor', [])
.directive 'ckeditor', ->
require: '?ngModel'
link: (scope, elm, attr, ngModel)->
ck = CKEDITOR.replace elm[0]
unless ngModel then return
ck.on 'pasteState', ->
scope.$apply ->
ngModel.$setViewValue ck.getData()
ngModel.$render = (value)-> ck.setData ngModel.$viewValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment