I dont really have any experience with Angular so any help would be really welcome.
Disclaimer: I know allowing Editors to input html/js in this way could be dangerous. But this is for my own personal website so i am not worried too much.
There used to be an ng-bind-html-unsafe option in earlier angularJS versions but I think that's removed, now, I think you need to inject $sce service into your angularJS controller and use $sce.trustAsHtml(yourHtml); before it can be safely bound...
... I think ...
... I mean at times it just feels like voodoo ...
Anyway looking in the Umbraco source, I found this filter called 'safe_html':
ng-bind-html (Block Grid - Backoffice)
Hi everybody,
i have this one Grid Block with a string property which holds a html-formatted value. (for instance Youtube iframe).
Now the frontend is not a problem rendering it with Html.Raw().
I have trouble generating html in the backoffice Custom view. This snippet does not seem produce any result.
I dont really have any experience with Angular so any help would be really welcome.
Disclaimer: I know allowing Editors to input html/js in this way could be dangerous. But this is for my own personal website so i am not worried too much.
Thanks! David
Hi David
There used to be an ng-bind-html-unsafe option in earlier angularJS versions but I think that's removed, now, I think you need to inject $sce service into your angularJS controller and use $sce.trustAsHtml(yourHtml); before it can be safely bound...
... I think ...
... I mean at times it just feels like voodoo ...
Anyway looking in the Umbraco source, I found this filter called 'safe_html':
https://github.com/umbraco/Umbraco-CMS/blob/a49a9851dc81677637ec1823963c50d84ef360f3/src/Umbraco.Web.UI.Client/src/common/filters/safehtml.filter.js#L3
So I'm wondering if you can 'just' use that eg:
fingers crossed
Marc
This did it! Thank you Marc!
is working on a reply...