$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

thanks for your response!!

If i am putting the above code on top of HTML, it's still showing nothing but a blank page.

if I am commenting the $sce code then I can see the message popping up...

I have used a different div if data record not found

find_real_file.png

can you please be so kind to explain what do you mean by keeping the above line on the top of the HTML code, if I misunderstood?

 

thanks in advance!!

Regards,

Danish

 

You need to check when you want to display that message.

Open your catalog item inspect it(click control+shift+i)

Now control+right click on the item and go to Log to console:$scope.data

check can_view is true or not for sc_cat_item

 

Refer the screenshot.

find_real_file.png

 

Now in your HTML code add like:

<div ng-if="data.sc_cat_item.can_view" class="alert alert-info">
"you are not authorized, please contact SD".
</div>