简体   繁体   English

如何使用mobile-angular-ui在按钮单击上显示模式对话框

[英]how to show a modal dialog box on a button click using mobile-angular-ui

Mobile Angular UI Is getting popular which is nothing but bootstrap 3 and angularjs combination 移动Angular UI越来越流行,不过就是bootstrap 3和angularjs的结合

I would like to create a modal dialog box on button click and close the dialog on close icon, how to do it? 我想在按钮单击上创建一个模式对话框,然后在关闭图标上关闭对话框,该怎么做?

Based on the docs it says 根据文档

<div ui-content-for="modals">
    <div class="modal" ui-if="modal1" ui-state='modal1'>
      .....
    </div>
</div>

But how to call this dialog, I tried this 但是如何调用此对话框,我尝试过

<button ui-turn-on="modal1" class="btn btn-primary">Show Model</button>

But it is not working as expected, I am getting Warning: Attempt to set uninitialized shared state: modal1 error 但是它没有按预期工作,我得到Warning: Attempt to set uninitialized shared state: modal1错误

I think you have placed ui-content-for inside the ui-yield-to 我认为您已将ui-content-for放入ui-content-for ui-yield-to

Put it outside that div tag as follows 如下将其放在该div标签之外

<div ui-yield-to="modals"></div>
<div ui-content-for="modals">
    <div class="modal" ui-if="modal1" ui-state="modal1">
       ....your model html code
    </div>
</div>

So that modals will remain as a place holder 这样modals将保留为占位符

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

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