vitalets / angular-xeditable

Edit in place for AngularJS
http://vitalets.github.io/angular-xeditable
MIT License
1.91k stars 403 forks source link

Use editable-text with $sce.trustAsHtml? #401

Closed ericyd closed 8 years ago

ericyd commented 8 years ago

Hello, thank you for this awesome package. I'm trying to use the editable-text directive with html data. If I inject the data using {{ data.html }}, it displays it as plain text instead of html (obviously). But when I inject the data as <div ng-bind-html="data.html"></div>, the data is no longer editable, meaning that the editable dialog pops up, but the changes are not written to the $scope.

This is how I'm trying to use the directive:

<span editable-text="user.name"><span ng-bind-html="user.name"></span></span>

And this is the original data in my controller:

$scope.user = {name: $sce.trustAsHtml("my<br>name")};

Is there any way around this? I tried tinkering with the source but couldn't get it to behave correctly.

mitcht commented 8 years ago

This is not an actual issue with the project. Questions such as this are better suited to be posted on sites like stackoverflow.com, using their Q/A format. Thanks.