christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

$transition$.to.state.name remains the same using resolve #295

Open eokoneyo opened 8 years ago

eokoneyo commented 8 years ago

Hi, I stumbled on your project after searching for something to get me out the few seconds delay that occurs in .$on('stateChangeStart'), infact your project has solved my problem only that for the first state i get the correct state name, but for other state changes from that state the state name doesnt update. sad thing is my function needs to be able to know whatever state is being switched to before the state loads at all. Here is my service hooked to the resolve


       gc.resolve = function () {
            $rootScope.rootState = $transition$.to.state.name;
            return gc.pickCss($rootScope.rootState);        
        };

        gc.pickCss = function (rootState) {

            var currentCss = 'css/'+config.assets[rootState].css[config.environment];

            $rootScope.currentCss = config.baseUrl(currentCss); 

            return $rootScope.currentCss;
        };
christopherthielen commented 8 years ago

Can you demonstrate this in a plunker? There is a starter ui-router plunker here: http://plnkr.co/edit/UizFbJDDrSBtkfcDZGb6?p=preview