Skip to content

Instantly share code, notes, and snippets.

@IsraelOrtuno
Created June 27, 2014 10:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IsraelOrtuno/d6de642ffa5a725abdf2 to your computer and use it in GitHub Desktop.
Save IsraelOrtuno/d6de642ffa5a725abdf2 to your computer and use it in GitHub Desktop.
// 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();
});
}
})
});
@kevinrogerteng
Copy link

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment