Angular SCE trust HTML variable in rootScope function

I’m trying to pass a variable from an Angular scope function, such that the HTML contents of a TinyMCE textarea are rendered in an ng-bind-html. Unsure why the following functions are still getting $sce.unsafe error

rootScope$rootScope, $http, $sce, $compile) {
    // Text Parsing
    $rootScope.txtRefresh = function(obj) {
      obj = $sce.trustAsHtml(obj);


$scope.txtRefresh = function (obj) {


<label>Paragraph 1</label>
<textarea data-ui-tinymce ng-change="txtRefresh(field['txt-1'])" type="text" class="form-control" ng-model="field['txt-1']" rows="4" placeholder="Description..." />
<div ng-bind-html="field['txt-1']"></div>


You should call the function to trust the resource directly in the binding. So: txtRefresh(field['txt-w']

$sce.trustAsHtml returns a trusted resource, it does not modify the string passed to it. Therefore, your ngChange isn’t doing anything meaningful. You could alternatively call a function on changes that trusts the value in field['txt-w'] and stores it in the scope, and then have ng-bind-html use that new trusted value.