ui-router-extras 的默认非活动状态 [英] default inactive state for ui-router-extras

查看:13
本文介绍了ui-router-extras 的默认非活动状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ui-router-extras 来支持模态窗口的并行状态.当模态窗口打开时,home"状态变为非活动状态,但在后台仍然可见.这使我可以为每个模态窗口提供深层链接.

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.

但是,如果用户通过模态窗口链接进入,我很难找到将默认"非活动状态设置为home"的好方法.

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'
        });
    }
})

推荐答案

查看 ui-router-extras 0.0.12 及更高版本.我在 DSR 中添加了对默认子状态的支持.有关详细信息,请参阅此 github 问题:

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/问题/150

并在此处阅读更新的 API 文档:http://christopherthielen.github.io/ui-router-extras/#/dsr

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-router-extras 的默认非活动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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