默认不活动状态的UI路由器演员 [英] default inactive state for ui-router-extras

查看:160
本文介绍了默认不活动状态的UI路由器演员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 UI的路由器额外来支持并行状态模态窗口。当一个模态窗口打开时,家的状态变为无效,但仍然在后台可见。这让我有很深的链接,每一个模态窗口。

不过,我无法想出一个好办法,设置默认不活动状态,以家如果一个用户来通过一个模式窗口的链接。

目前,我这样定义我的状态:

  $ stateProvider
.STATE('注册',{
    网址:'/注册,
    的OnEnter:函数($模态){
        $ modal.open({
            templateUrl:singup.html',
            大小:大,
            控制器:'SignUpController
        });
    }
})


解决方案

检查UI的路由器额外释放0.0.12以上。我已经添加了对DSR默认子状态的支持。详情请参见本github上的问题:

https://github.com/christopherthielen/ui-router-extras/问题/ 150

和读取更新的API文档在这里: HTTP://christopherthielen.github。 IO / UI的路由器演员/#/ DSR

  VAR myState = {
    名称:'富',
    网址:'/富/:fooID /:barID',
    模板:'< D​​IV>< / DIV>中
    控制器:'fooCtrl',
    deepStateRedirect:{
        默认:{状态:foo.bar.baz.defaultSubState,则params:{defaultStateParam1:99}}
    }
}

I am using ui-router-extras to support parallel state for modal windows. When an modal window is open, the "home" state become inactive, but is still visible in the background. This allows me to have deep link for each modal windows.

However, I am having trouble figure out a good way to set the "default" inactive state to "home" if an user come through a modal window link.

I currently define my states like this:

$stateProvider
.state('signup', {
    url: '/signup',
    onEnter: function($modal) {
        $modal.open({
            templateUrl: 'singup.html',
            size: 'large',
            controller: 'SignUpController'
        });
    }
})

解决方案

check out ui-router-extras release 0.0.12 and above. I've added support for default substates in DSR. See this github issue for details:

https://github.com/christopherthielen/ui-router-extras/issues/150

And read the updated API docs here: http://christopherthielen.github.io/ui-router-extras/#/dsr

var myState = {
    name: 'foo',
    url: '/foo/:fooID/:barID',
    template: '<div></div>,
    controller: 'fooCtrl',
    deepStateRedirect: {
        default: { state: "foo.bar.baz.defaultSubState", params: { defaultStateParam1: "99" } }
    }
}

这篇关于默认不活动状态的UI路由器演员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆