当寻找ngx引导程序 https://valor-software.com/ngx-bootstrap/#/ 源代码 https://github.com/valor-software/ngx-bootstrap here:
模态选项.class.ts https://github.com/valor-software/ngx-bootstrap/blob/development/src/modal/modal-options.class.ts
有一个可选的class property
定义为class?: string;
.
使用方法是什么?
是否可以添加自定义类,例如:
this.modalService.config.class = 'myClass';
在使用服务之前,例如:
this.modalRef = this.modalService.show(template, {
animated: false
});
这样,我想我们可以将自定义 CSS 添加到显示的模式中
我尝试添加自定义类但没有成功。
该类属性不是数组,如果适用,是否意味着我们只能添加一个自定义类?
Demo:通过添加和覆盖modal
类,模态未显示
https://stackblitz.com/edit/ngx-bootstrap-3auk5l?file=app%2Fapp.component.ts https://stackblitz.com/edit/ngx-bootstrap-3auk5l?file=app%2Fapp.component.ts
添加modal
这种方式没有帮助:
this.modalRef = this.modalService.show(template, Object.assign({},
this.config, { class: 'gray modal-lg modal' }));
https://stackblitz.com/edit/ngx-bootstrap-awmkrc?file=app%2Fapp.component.ts https://stackblitz.com/edit/ngx-bootstrap-awmkrc?file=app%2Fapp.component.ts