简体   繁体   English

如何从控制器打开Mobile-Angular-ui模式

[英]How to open Mobile-Angular-ui modal from controller

I have seen the demo to show pop-up http://mobileangularui.com/demo/#/overlay 我看过演示弹出窗口的演示http://mobileangularui.com/demo/#/overlay

In the example has been used Directive into template 在示例中已将Directive插入模板

ui-turn-on="modal1"

I need to activate the pop-up from controller. 我需要从控制器激活弹出窗口。

I think I have to use SharedState, but I was unable to create a working example. 我认为我必须使用SharedState,但无法创建一个有效的示例。

Can you help me? 你能帮助我吗?

I had similar problem. 我有类似的问题。

The following code solved my problem: 以下代码解决了我的问题:

$rootScope.Ui.turnOn('modal1')

You need to declare the SharedState in the controller and then just use it like this: 您需要在控制器中声明SharedState,然后像这样使用它:

SharedState.turnOn('name_of_modal_id');

and/or 和/或

SharedState.turnOff('name_of_modal_id');

Does not require anything special. 不需要任何特殊的东西。 Its simple. 这很简单。

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

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