- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 02:14 PM
I have created a widget which is population html field on the portal but style is getting messed, its not showing color. ( u_class_name is html type field)
HTML :
<div id="modalTemplate" >
<div class="panel panel-default">
<div class="panel-heading">
</div>
<div class="panel-body wrapper-xl">
<div ng-bind-html="::data.name"></div>
</div>
</div>
Server Script :
(function() {
var gr = new GlideRecord('u_class');
gr.query();
if (gr.next()) {
var obj = {};
data.name = gr.getValue('u_class_name');
}
})();
Client Controller :
function($scope,spUtil, $uibModal) {
var c = this;
c.openModal = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
scope: $scope
});
}
c.closeModal = function() {
c.modalInstance.close();
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2022 03:46 PM
Hello Sneha,
Please check this community thread:
Displaying html fields in widget - Service Portal
From what I can see, you need to do some changes to your client controller:
Client Controller :
function($scope,spUtil, $uibModal, $sce) {
var c = this;
// Display HTML field
$scope.data.name = $sce.trustAsHtml($scope.data.name);
c.openModal = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
scope: $scope
});
}
c.closeModal = function() {
c.modalInstance.close();
}
}
Check if this works!
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Best Regards,
Filipe Cruz

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 02:47 AM
Hello Sneha,
try to replace <div ng-bind-html="::data.name"></div> by
<div ng-bind-html="data.name"></div>
Check if this helps!
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Best Regards,
Filipe Cruz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 03:51 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2022 05:39 AM
Hello Sneha,
Yep, I think you are right.
Try to rewrite the server script and let me know your findings.
Best Regards,
Filipe Cruz