I try to integrate The beautifull WYSIWYG Redactor (http://imperavi.com/redactor/) in an custom AngularJS directive.
Visualy it works, but my custom directive is not compatible with ng-model (and I don't understand why)
This is how you can use my directive :
<wysiwyg ng-model="edited.comment" id="contactEditCom" content="{{content}}" required></wysiwyg>
And this is the directive code :
var myApp = angular.module('myApp', []);
myApp.directive("wysiwyg", function(){
var linkFn = function(scope, el, attr, ngModel) {
    scope.redactor = null;
    scope.$watch('content', function(val) {
        if (val !== "")
        {
            scope.redactor = $("#" + attr.id).redactor({
                focus : false,
                callback: function(o) {
                    o.setCode(val);
                    $("#" + attr.id).keydown(function(){
                        scope.$apply(read);
                    });
                }
            });
        }
    });
    function read() {
        var content = scope.redactor.getCode();
        console.log(content);
        if (ngModel.viewValue != content)
        {
            ngModel.$setViewValue(content);
            console.log(ngModel);
        }
    }
};
 return {
     require: 'ngModel',
     link: linkFn,
     restrict: 'E',
     scope: {
         content: '@'
     },
     transclude: true
 };
});
And finally this is the fiddle -> http://fiddle.jshell.net/MyBoon/STLW5/
 
     
     
     
     
     
    