0

Sometimes state which i define is not render and shows blank page. And at this time when i try to see from console which state is this, it shows like below.

state name shows empty, which is not defined in my app.

enter image description here

Anybody know about this issue please help me.

1 Answer 1

1

I am guessing you see the full object in console because it gets filled later and the browser reacts.. Try to include your block with $state into a $timeout(). It's a trick to wait for the $digest cycle to be over before getting the value.

$timeout(function() { console.log($state.current.name); }); 

or

$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) { var statename = toState.name console.log(statename) }) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.