angular-ui-路由器:如何清除和重新配置状态?

angular-ui-router: how to clear and reconfigure states?

我正在 app.run 中动态加载我的状态(基于服务器调用)。 window.$stateProviderRef 只是对 app.config(..)

中 window 对象上设置的 $stateProvider 的引用
app.run(function($http) {
    $http.get('/api/states').
        success(function(data, status, headers, config) {

            angular.forEach(data, function(state) {
                window.$stateProviderRef.state(state.name, { url: state.url, templateUrl: state.templateUrl) : state.templateUrl });
            });

        });

});

是否可以以某种方式清除或重新加载状态配置?以便以前的状态无效并加载新状态?

目前实际上不可能,但在 Angular 路线图上,您可以在此处了解进度 https://github.com/angular-ui/ui-router/issues/1095