$sce.trustAsHtml stopping message to display on portal

Mohammad Danis1
Giga Guru

Hi ,

can anyone please let me know what is the below code is doing and what will be the impact if I comment this?

$scope.data.sc_cat_item.description = $sce.trustAsHtml($scope.data.sc_cat_item.description);

Thanks in advance!!

 

Regards,

Danish

6 REPLIES 6

Hi Ravi,

 

Thanks for your response!!

 

That I have checked before what if I comment this?

As what the code I have written is working fine if I am commenting this. any idea?

 

Regards,

Mohammad Danish

What is the message you are displaying ? 

If you are binding the value directly on HTML side using ng-bind-html it won't be any problem. You can go a head and comment out the line to serve your purpose.

Ravi,

if user is not group authorized to see any catalog item, he should see a message "you are not authorized, please contact SD".

 

I have store the message in var  invalidRecordMsg on server side script and below is the HTML code.

<div ng-if="::!data.recordFound" class="alert alert-info">{{::m.invalidRecordMsg}}</div>

 

It's working fine if I am commenting below code on client side:

 $scope.data.sc_cat_item.description = $sce.trustAsHtml($scope.data.sc_cat_item.description);

 

Please suggest if you have any idea!!

 

Danish

 <div ng-if="::!data.recordFound" class="alert alert-info">{{::m.invalidRecordMsg}}</div> 

 

Where did you keep this line in HTML code ?

 

As you are checking the access to the user for the current catalog item keep the above line on the top of the HTML code. If you put it inside the div having the class Wrapper it will not display as it is checking for description value.

 

Mark Correct if it solves your issue.