// json
"_unparsedstring": "<p>test<\/p>" // html
<div>preamble : '{{item2._unparsedstring}}'</div> //output
preamble : <p>test<\/p> but how render tag , display using angular ?
//output should this
preamble : test
instead of passing string view directly, should use sce.trustashtml pre-process html.
$scope.bindhtml = $sce.trustashtml(item2._unparsedstring); then in view template, use ng-bind-html handle html binding.
<div>preamble : <div ng-bind-html="bindhtml"></div></div> as mentioned have array of object, it's not easy cast them in controller, can bind $sce $scope call trustashtml in view
so in controller
myapp.controller('maincontroller', function ($scope, $http, $filter, $sce) { $scope.$sce = $sce; ... } then in html view
<div>preamble {{$index+1}} : <span ng-bind-html="$sce.trustashtml(item1.preamble._unparsedstring)"></span></div>
Comments
Post a Comment