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

I am dynamically loading my states (based on the server call) into app.run

. window.$stateProviderRef

is just a reference to $stateProvider

, set on the window object inapp.config(..)

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

        });

});

      

Is there any way to clear or reload the state configuration? So the previous states are invalidated and new states are loaded?

+3


source to share


1 answer


This is not possible at the moment, but on the Angular roadmap you can keep up with progress here https://github.com/angular-ui/ui-router/issues/1095



+3


source







All Articles