$sce.trustAsHtml stopping message to display on portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2018 11:31 PM
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
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2018 05:40 AM
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2018 06:12 AM
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.
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>