$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-03-2018 11:58 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2018 01:03 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2018 02:50 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2018 05:05 AM
<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.