$uibModal embed HTML content [external content] on widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 11:14 AM
hey there
i have a widget with that code:
HTML:
<script type="text/ng-template" id="modalTemplate">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">Bynet Terms Confirmation</h4>
</div>
<div class="panel-body wrapper-xl">
</div>
<div class="panel-footer text-right">
<button class="btn btn-primary" ng-click="c.closeModal()">${Approve}</button>
</div>
</div>
</script>
client:
c.openModal = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplate',
size: 'lg',
scope: $scope
});
}
c.closeModal = function() {
c.modalInstance.close();
c.data.open = true;
c.data.action = 'approved';
$scope.server.update().then(function() {});
}
I want to embed on the modal window data from external file
i can copy the data to HTML but i dont want to save it on the widget
i want to load it from outside the widget
it is "Terms and conditions" file
any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 12:12 PM
hey!
my content is static yes.
i saw oon the servicenow system "static HTML" it will be nice if i can put my data there and to call it. what do you think ?
to create new static content
to put my static data on the static content field
is it possible to present it on the uibModal ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 12:28 PM
Yes, there's a HTML data type that can be used to store HTML data. If you'd put the static content into a table field, then you'd need to query the table and get the record that has the static HTML.
Basically on the server script of your widget, you'd need to do:
data.htmlContent = ''; //if you don't want to query any table, put the file HTML here directly
var gr_table = new GlideRecord('your_table_name');
gr_table.addQuery('your_field', 'your_value');
gr_table.query();
if(gr_table.next()) {
data.htmlContent = gr_table.getValue('you_HTML_field_name');
)
Then, on the client script, use the $scope.data.htmlContent variable to set the value of the $uibModal template property.
Thanks & Regards,
Rishabh Jha
Aavenir (https://www.aavenir.com/)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 12:56 PM
it is not working for me
mabye you have a few minutes for Teams session?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2020 08:09 PM
Hi
Sorry I had logged off as it was quite late for me (IST). Can you please tell me what have you tried?
If you can share the table and field names where you put the static HTML, and the snippets of your widget code, we can try to figure it out.
Thanks & Regards,
Rishabh Jha
Aavenir (https://www.aavenir.com/)