Can anyone help me understand how to update the content within a modal once it's been opened? I need to trigger a modal when a specific event from a websocket occurs.
Following that event, I receive status updates and wish to replace the modal's current content with those statuses.
This is the snippet of code I use to open a modal:
var modalInstance = $uibModal.open({
animation: true,
template: r.message.description,
windowTemplateUrl: 'modal.html',
controller: 'ModalController',
backdrop: true,
size: 'lg',
resolve: {}
});
The content of modal.html is as follows:
<script type="text/ng-template" id="modal.html">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Document Reader</h4>
</div>
<div class="modal-body" uib-modal-transclude>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</script>
The variable r.message.description
holds a string obtained from the websocket. This is what needs to be replaced within the modal.