angular - 如何增加ngbmodal的宽度
问题描述
我需要知道如何增加 ngbModal 框的大小?由于盒子的尺寸很小,一些字体显示在盒子外面。
<ng-template #deletecontent2 let-c="close" let-d="dismiss" >
<div class="modal-header text-center" >
<h2 class="modal-title text-center" style="font-weight: 500">Policy Details</h2>
<button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="col-md-6 col-xs-6 col-lg-6 col-sm-6" align="center">
<div class="text-left"><h5 style="font-weight: 500">Policy Details</h5></div>
<div class="text-center" *ngIf="selectedDeal">
<p>Plan : {{selectedDeal.plan}}</p>
<p>Room Limit : {{selectedDeal.room_limit || 'N/A'}}</p>
<p>Issuance Date : {{selectedDeal.issuance_date || 'N/A'}}</p>
</div>
</div>
<div class="row" >
<div align="center" >
<div class=" text-center"><h5 style="font-weight: 500">Terms & Condition</h5></div>
<div *ngIf="displayData && displayData.length > 0" style="text-align: center">
<tr *ngFor="let policy of displayData" class="block_container1"><div class="bloc1">{{policy.name}} :</div><div class="bloc2"> {{policy.value}}</div></tr>
</div>
</div>
</div>
</ng-template>
.ts
openDeal2(deletecontent2,se){
this.selectedDeal = se;
this.dealModal= this.modalService.open(deletecontent2, se);
this.dealModal.result.then(r=>{
}, err=> console.log(err))
console.log(this.selectedDeal.policywording);
this.wording = this.selectedDeal.policywording;
this.displayData = [];
if (this.wording) {
const policies = this.wording.split('|').filter(w => w !== '');
this.displayData = [];
policies.forEach((policy) => {
const splited = policy.split('=');
const displayPolicy = {name: splited[0], value: splited[1]};
this.displayData.push(displayPolicy);
});
}
}
只需要增加方框一点点,只需要在方框中显示字体即可。谢谢
解决方案
我不确定您希望盒子有多大或多小,但您实际上可以使用该size
属性,该属性可以通过 NgbModal 服务通过提供第二个参数来更改NgbModalOptions
。您可以参考文档本身的更多详细信息。
this.modalService.open(content, {
size: 'lg',
// other properties
});
否则,如果您有任何自定义样式要求,您可以使用该windowClass
属性,并将其传递给NgbModalOptions
.
this.modalService.open(content, {
windowClass: 'your-class'
// other properties
});
推荐阅读
- python - 使用 python 从 Flickr 下载给定 ID 的照片统计信息
- php - 如何在没有身份验证默认值的情况下实现身份验证防护
- c# - 我将如何优化这个 if 语句
- angular - 传单折线和多边形绘图无法正常工作
- c++ - type_traits 中检查类型是否为 const char* 的函数是什么?
- javascript - JQuery AJAX url 调用 - 有时不起作用
- php - 查询具有关系的模型字段
- azure - 如何通过命令行将 Azure 服务主体详细信息传递给 Ansible?
- javascript - 如何通过 Web 应用程序的跨浏览器播放 .h264(例如:globalwarming.h264)视频文件
- git - 解决远程 git 上的合并冲突问题