0

Its printing html as it is(non html formatted data is shown in UI) Tried with ng-bind-html but didnt work Also tried using https://stackoverflow.com/a/25535684/6050814 not worked

$http({
        method: 'POST',
        url: 'http://.../req/get',
        data: '{"source":"careers","code":"","reqId":406}'
    }).then(function (response) {
        $rootScope.myHTML = $sce.trustAsHtml(JSON.stringify(response.data.reqDetailsBO.reqTitle));
        //alert(JSON.stringify(response.data.reqDetailsBO.jdDisplay));
        //$scope.content = JSON.stringify(response.data.reqDetailsBO.jdDisplay)```;           
    });

//following is my html

<div ng-bind-html="myHTML"></div>

//these are dependencies I am injecting

angular.module('app.controllers', ['ionic.cloud','ngSanitize'])

//following is data I am trying to bind with

<span class="preheader" style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;"> Notification </span>

8
  • 1
    show us what u tried so far Commented Mar 23, 2017 at 11:32
  • Try $sce service with trustAsHtml(String) method or give your code snippet Commented Mar 23, 2017 at 11:35
  • and the html code Commented Mar 23, 2017 at 11:41
  • tried $sce @GitaramKanawade not working Commented Mar 23, 2017 at 11:50
  • @sachilaranawaka I have updated question Commented Mar 23, 2017 at 11:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.