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

时间:2016-02-17 11:07:38

标签: angularjs mobile-angular-ui

Mobile Angular UI越来越受欢迎了,只有bootstrap 3和angularjs组合

我想在按钮上单击创建一个模态对话框并关闭关闭图标上的对话框,怎么做?

基于它所说的docs

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

但如何调用此对话框,我尝试了这个

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

但它没有按预期工作,我收到Warning: Attempt to set uninitialized shared state: modal1错误

1 个答案:

答案 0 :(得分:2)

我认为您已将ui-content-for放入ui-yield-to

将其置于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>

这样modals将继续作为占位符