Created
September 25, 2016 22:34
-
-
Save eristoddle/48bd59a990156392124b6fb609939667 to your computer and use it in GitHub Desktop.
Angular 1 contenteditable Directive
This file contains 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
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