简体   繁体   English

禁用外部点击时关闭ngx-smart-modal

[英]Disable the closing of ngx-smart-modal on outside click

I am using the ngx-smart-modal and it is working fine but the problem is that I want to disable it closing when a click is initiate outside the modal or in the body. 我正在使用ngx-smart-modal,它工作正常,但问题是当在模态外部或体内发起单击时,我想禁用它关闭。

<button class="btn btn-primary" (click)="ngxSmartModalService.getModal('classicModalregister').open()">Register</button>
<ngx-smart-modal #popupRegister [identifier]="'classicModalregister'" customClass="medium-modal">
<h1>Register Here !</h1>
<p>dfdfd</p>
</ngx-smart-modal>

Following the documentation we can set parameter/option on ngx-smart-modal tag as the dismissable , the parameter that allow to close or not at outside click. 根据文档,我们可以将ngx-smart-modal标签上的参数/选项设置为dismissable ,该参数允许在外部单击时关闭或不关闭。

So we got [dismissable] = "false" 所以我们得到了[dismissable] = "false"

The fix: 解决方法:

<button class="btn btn-primary" (click)="ngxSmartModalService.getModal('classicModalregister').open()">Register</button> <ngx-smart-modal #popupRegister [identifier]="'classicModalregister'" customClass="medium-modal" [dismissable] = "false"> <h1>Register Here !</h1> <p>dfdfd</p> </ngx-smart-modal>

Remember: Always read the documentation! 切记:务必阅读文档!

Documentation: https://www.npmjs.com/package/ngx-smart-modal 文档: https : //www.npmjs.com/package/ngx-smart-modal

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM