Directiva ng-model para wysiwyg
app.directive('textEditor', function () {
return {
require: 'ngModel',
link: function(scope, element, attributes, controller) {
scope.$watch(attributes.ngModel, function(value) {
$(element).html(value);
});
element.bind('keyup mouseup', function(){
controller.$setViewValue(element.html());
if (!scope.$$phase) {
scope.$apply();
}
});
}
};
});