【发布时间】:2019-01-14 18:09:08
【问题描述】:
我在 ServiceNow 中工作并尝试使用 $uibModal 打开一个包含嵌入式小部件的模式窗口。模态在第一次单击时打开良好,但之后的每次单击都需要两次单击才能使模态加载正确的内容。我在一些网站上读到这是因为模板缓存不清除,有些人建议不要使用脚本标签,但我不确定如何在没有 ServiceNow 中的脚本标签的情况下让 uibModal 工作。有没有人遇到过这个?很想得到一些关于如何解决这个问题的建议。
这是我的客户端脚本:
c.onWidget2 = function(template, task) {
c.taskName = task.short_description;
c.modalInstance = $uibModal.open({
templateUrl: template,
scope: $scope,
size: 'lg'
});
spUtil.get('hrj_task_activity_scoped', {
sys_id: task.sys_id,
table: 'sn_hr_core_task',
recordInfo: task.taskInfo
}).then(function(response) {
c.newTask2 = response;
});
};
//closeModal for the "x"
c.closeModal = function() {
c.modalInstance.close();
};
这是我的 HTML:
<div class="card" ng-click="c.onWidget2('newTask2',task);"></div>
<script>
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h4 class="panel-title pull-left">{{c.taskName}}</h4>
<span ng-click="c.closeModal()"><i class="fa fa-times pull-right"></i></span>
</div>
<sp-widget widget="c.newTask2" options="c.newTaskOptions"></sp-widget>
</div>
</script>
【问题讨论】:
标签: angularjs modal-dialog servicenow angular-templatecache