- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 06:03 AM
Hey All,
I have a task with an HTML field, and I want to display the HTML as it shows on the screen, but when I return it to the widget, I just get the tags and no formatting.
Is there any way to transform this to show html? Is this where I would use something like "ng-bind-html"?
Still fairly green when it comes to angular and widget development but learning on the fly.
Any help is greatly appreciated.
Thank you very much in advance,
Jim
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- 13,084 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2017 06:56 AM
Hi,
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 it helpful
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2017 06:29 AM
You're welcome
Anaí¯s
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2018 08:54 AM
I am trying to do something similar but it just keeps showing up as [object Object] on my widget in the portal.
My HTML field is u_approval_instructions
Added the HTML:
<div ng-bind-html="::data.u_approval_instructions"></div>
Client Script:
function ($scope, $animate, $rootScope, $sce) {
$scope.$watch("data.task", function() {
$scope.task = $scope.data.task; // copy for shortcuts above
})
}
function($scope, $sce) {
/* widget controller */
var c = this;
// Display HTML field
$scope.data.u_approval_instruction = $sce.trustAsHtml($scope.data.u_approval_instruction);
}
Server Script:
data.u_approval_instructions = task.u_approval_instructions;
This is the result I am getting:
Am I missing something?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2018 07:34 AM
YASSS Thank you!!