自定义css与ngx引导模式



文档(https://valor-software.com/ngx-bootstrap/#/modals#service-自定义css类(表示使用

<button type="button" class="btn btn-primary" (click)="openModalWithClass(template)">Open modal with custom css class</button>
<br>

<ng-template #template>
<div class="modal-header">
<h4 class="modal-title pull-left">Modal</h4>
<button type="button" class="close pull-right" aria-label="Close" (click)="modalRef.hide()">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Just a modal with a bunch of words inside, nothing serious.
</div>
</ng-template>

并显示";模板";在功能中

openModalWithClass(template: TemplateRef<any>) {
this.modalRef = this.modalService.show(
template,
Object.assign({}, { class: 'gray modal-lg' })
);

但是我为模态创建了一个组件(太大了,不能在同一个组件中(,所以html中没有#template,我如何从我的另一个html组件导入#template-id?

非常感谢

如果您试图从另一个组件打开模态组件,那么这是使用ngx引导的正确方法:https://valor-software.com/ngx-bootstrap/#/modals#service-组件

最新更新