Created
June 27, 2014 10:29
-
-
Save IsraelOrtuno/d6de642ffa5a725abdf2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Editable fields with a WYSIWYG | |
$(function() { | |
$('.selector').editable({ | |
// Set custom buttons with separator between them. | |
buttons: ["undo", "redo", "sep", "bold", "italic", "underline", "sep", "insertOrderedList", "insertUnorderedList", "sep", "createLink"], | |
inverseSkin: true, | |
inlineMode: false, | |
preloaderSrc: window.location.origin + 'assets/image/preloader.gif', | |
// This is what matters | |
contentChangedCallback: function () { | |
var $this = this; | |
// Altering the model manually as there was no way to update it automatically | |
var scope = angular.element(".selector").scope(); | |
scope.$apply(function(){ | |
scope.activity.description = $this.getHTML(); | |
}); | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey man, thanks for taking the time to show this! It worked and I completely forgot about the callback and doing .$apply.
I really appreciate it!