How to update the html type field in the widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2020 04:32 AM
Hi ,
I have a form with a field 'description' which is of HTML type . I want to show the same piece of information(in terms of look n feel- -red , bold , underlined , hyperlinks ) in the widget .
I have used <div ng-bind-html="::field name"></div> in the HTML of the widget , If the value in the 'description' field in the form is bold and in italics , then the same information is shown in the Widget .
But if the value in the description field is written with Red text and with underlined text , then the same is not displayed in the widget in the portal .
Can anyone say what am i missing .
Regards,
Naresh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2020 04:47 AM
Yes there is the bind html.
Here is an example of HTML code:
<div ng-bind-html="::data.desc" "></div> (where data.desc is your HTML field that you get in the server part)
and the client side:
function($scope, $sce) {
/* widget controller */
var c = this;
// Display HTML field
$scope.data.desc = $sce.trustAsHtml($scope.data.desc);
}
Please mark if it's helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2020 05:10 AM
Hi Zaib,
I used the same logic , but it doesnt seem to work , when i am entering the text in Red , or with some underline text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2020 05:21 AM
Can you share your code here ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2020 05:32 AM
Hi Zaib,
Server script:
data.btnTable = 'x_tab';
var gr = new GlideRecord(data.btnTable);
gr.addActiveQuery();
while (gr.next()) {
var app = {};
app.desc = gr.description.getDisplayValue();
}
HTML Code:
<div ng-bind-html="::app.desc"></div>
Client controller:
$scope.app.desc = $sce.trustAsHtml($scope.app.desc);
Here's the code