Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@eristoddle
Created September 25, 2016 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eristoddle/48bd59a990156392124b6fb609939667 to your computer and use it in GitHub Desktop.
Save eristoddle/48bd59a990156392124b6fb609939667 to your computer and use it in GitHub Desktop.
Angular 1 contenteditable Directive
app.directive("contenteditable", ['$rootScope', function ($rootScope) {
return {
restrict: "A",
link: function (scope, element, attrs) {
var content = '';
element.bind("blur keyup change focus", function (event) {
content = element.html();
$rootScope.editableContent = content;
});
}
};
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment