Home Angular SCE trust HTML variable in rootScope function
Reply: 0

Angular SCE trust HTML variable in rootScope function

user951
1#
user951 Published in April 26, 2018, 1:44 pm

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

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

Controller

$scope.txtRefresh = function (obj) {
  $rootScope.txtRefresh(obj);
}

Partial

<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 need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.459037 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO