{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/1627","labels_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1627/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1627/comments","events_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1627/events","html_url":"https://github.com/angular-ui/ui-router/issues/1627","id":51788887,"number":1627,"title":"$state.current is sometimes 'empty'","user":{"login":"panuhorsmalahti","id":2162413,"avatar_url":"https://avatars.githubusercontent.com/u/2162413?v=3","gravatar_id":"","url":"https://api.github.com/users/panuhorsmalahti","html_url":"https://github.com/panuhorsmalahti","followers_url":"https://api.github.com/users/panuhorsmalahti/followers","following_url":"https://api.github.com/users/panuhorsmalahti/following{/other_user}","gists_url":"https://api.github.com/users/panuhorsmalahti/gists{/gist_id}","starred_url":"https://api.github.com/users/panuhorsmalahti/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/panuhorsmalahti/subscriptions","organizations_url":"https://api.github.com/users/panuhorsmalahti/orgs","repos_url":"https://api.github.com/users/panuhorsmalahti/repos","events_url":"https://api.github.com/users/panuhorsmalahti/events{/privacy}","received_events_url":"https://api.github.com/users/panuhorsmalahti/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2014-12-12T10:03:12Z","updated_at":"2015-11-25T11:30:56Z","closed_at":"2014-12-12T12:37:18Z","body":"I encountered this strange bug today. Sometimes (I don't know why) $state.current returns an \"empty\" object:\r\n\r\nThere's at least two stackoverflow issues about this bug:\r\nhttp://stackoverflow.com/questions/25370775/exposing-the-current-state-name-with-ui-router\r\nhttp://stackoverflow.com/questions/24895908/how-do-return-the-state-current-name-from-ui-router-statechange\r\n\r\nI can't explain the bizarre behaviour I'm seeing: When I debug $state I can see that $state.current is fine, but when I print $state.current directly I get this:\r\n\r\n```\r\n{ name: \"\", url: \"^\", views: null, abstract: true }\r\n```\r\n\r\n$state.$current.self is also the same empty object., even though it looks fine when I inspect $state.\r\n\r\nI don't quite understand how this can be happening. How can $state and $state.current return different values? $state.current doesn't have a getter.\r\n\r\nEDIT: Okay, the problem was that the debugger doesn't show the object when it was printed, rather it shows it's current state. Now I just need to figure out why the state is empty.\r\n"},"comment":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/comments/159578316","html_url":"https://github.com/angular-ui/ui-router/issues/1627#issuecomment-159578316","issue_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1627","id":159578316,"user":{"login":"ddctd143","id":5021070,"avatar_url":"https://avatars.githubusercontent.com/u/5021070?v=3","gravatar_id":"","url":"https://api.github.com/users/ddctd143","html_url":"https://github.com/ddctd143","followers_url":"https://api.github.com/users/ddctd143/followers","following_url":"https://api.github.com/users/ddctd143/following{/other_user}","gists_url":"https://api.github.com/users/ddctd143/gists{/gist_id}","starred_url":"https://api.github.com/users/ddctd143/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddctd143/subscriptions","organizations_url":"https://api.github.com/users/ddctd143/orgs","repos_url":"https://api.github.com/users/ddctd143/repos","events_url":"https://api.github.com/users/ddctd143/events{/privacy}","received_events_url":"https://api.github.com/users/ddctd143/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T11:30:56Z","updated_at":"2015-11-25T11:30:56Z","body":"I don't understand.\r\nIf i console.log($state) it shows correct state, if i console.log($state.current) then it shows empty string, so how can I get current nested state ?"}}