UI-Router nested - multiple views , hold a view and change another view as the time

UI-Router nested - multiple views , hold a view and change another view the same time

考虑以下布局:

我有两个视图,视图 A 和视图 B。我正在尝试加载 A view 中的用户菜单和 B view 中的菜单内容。

我试过这个: 首先,我在 A view 中加载了我的菜单,然后当我尝试查看菜单时,ui-router 将使 A view 为空并加载 B view.

如何在 B view 状态发生变化时保持 A view 状态?

也许我这样做的方式是完全错误的。

更新 1: 这是我的路线配置:

$stateProvider
    .state("login", {
        url: "/login",
        views: {
            "login": {
                templateUrl: "./static/views/login.html",
                controller: loginController
            }
        }
    })
    .state("dashboard", {
        url: "/dashboard",
        views: {
            "view-a": {
                templateUrl: "./static/views/dashboard.html"
            }
        }

    })
    .state("test", {
        url: "/test",
        views: {
            "view-b": {
                templateUrl: "./static/views/test.html"
            }
        }
    });

您似乎希望 B 成为 A 的嵌套视图。有几种不同的方法可以实现这一点,这里是文档 https://github.com/angular-ui/ui-router/wiki/Nested-States-and-Nested-Views

此方法将提供在 /dashboard/test

查看 B 的可能路线
$stateProvider
.state("login", {
    url: "/login",
    views: {
        "login": {
            templateUrl: "./static/views/login.html",
            controller: loginController
        }
    }
})
.state("dashboard", {
    url: "/dashboard",
    views: {
        "view-a": {
            templateUrl: "./static/views/dashboard.html"
        }
    }

})
.state("dashboard.test", {
    url: "/test",
    views: {
        "view-b": {
            templateUrl: "./static/views/test.html"
        }
    }
});

在 dashboard.html 中,您可以通过 <div ui-view="view-b"></div>

来引用视图 b