简体   繁体   English

Angular如何开通多模态?

[英]How to open multiple modal in Angular?

I use mat-dialog in aa project and there is a form field (dropdown) called course in this dialog.我在一个项目中使用mat-dialog ,并且在此对话框中有一个名为 course 的表单字段(下拉列表)。 I want to open another dialog in order to add a course record that is not available in the course list dropdown.我想打开另一个对话框以添加课程列表下拉列表中不可用的课程记录。 At this step, I am wondering what is a proper way for this scenario.在这一步,我想知道这种情况的正确方法是什么。

Should I open the second dialog inside the first dialog by setting the form fields of the second one?我应该通过设置第二个对话框的表单字段在第一个对话框中打开第二个对话框吗?

Or is it better just hiding first dialog and showing second and then after completing the operation on the second, close second ad show first one?还是只隐藏第一个对话框并显示第二个对话框然后在完成第二个操作后关闭第二个广告显示第一个更好?

If there is a demo of a proper approach for opening dialog on another I would be appreciated.如果有在另一个上打开对话框的正确方法的演示,我将不胜感激。

It depends on your preference, requirement and the library you have chosen.这取决于您的偏好、要求和您选择的图书馆。 Since you have already mentioned that you are using material dialog, it works fine with nested unlike bootstrap-modal.由于您已经提到您正在使用材料对话框,因此与引导模式不同,它可以很好地嵌套。 So, If I were you, I would go with nested modal by properly configuring z index and backdrop .所以,如果我是你,我会通过正确配置z indexbackdrop来使用嵌套模式 go 。

You can check this demo just to get idea,你可以查看这个演示来了解一下,

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

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