{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/1399","labels_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1399/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1399/comments","events_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1399/events","html_url":"https://github.com/angular-ui/ui-router/issues/1399","id":43828476,"number":1399,"title":"$stateChangeStart to wait for an ajax request (some manual promise to ressolve) without state.go()","user":{"login":"syrys","id":5236811,"avatar_url":"https://avatars.githubusercontent.com/u/5236811?v=3","gravatar_id":"","url":"https://api.github.com/users/syrys","html_url":"https://github.com/syrys","followers_url":"https://api.github.com/users/syrys/followers","following_url":"https://api.github.com/users/syrys/following{/other_user}","gists_url":"https://api.github.com/users/syrys/gists{/gist_id}","starred_url":"https://api.github.com/users/syrys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/syrys/subscriptions","organizations_url":"https://api.github.com/users/syrys/orgs","repos_url":"https://api.github.com/users/syrys/repos","events_url":"https://api.github.com/users/syrys/events{/privacy}","received_events_url":"https://api.github.com/users/syrys/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular-ui/ui-router/labels/feature","name":"feature","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":28,"created_at":"2014-09-24T23:53:28Z","updated_at":"2015-04-06T20:12:09Z","closed_at":null,"body":"Got a quick question for you guys.\r\n\r\nI want to be able to execute a possible ajax request from a factory on \"stateChangeStart\" event (i check some state parameters). Seems like if i event.preventDefault(), then call the factoryMethod for the ajax request, then on resolve do a state.go() to continue into the state, it simply gets caught in the same conditions and ends in an infinite loop. Obviously i can set some other flags somewhere to prevent this, but is there a better way to do it than this? Some alternative to state.go()?\r\n\r\nAlso tried { notify: false }, but that skips \"$stateChangeSuccess\" also. I want \"$stateChangeStart\" called only once and \"$stateChangeSuccess\" called only once, unless you get redirected to another page on fail condition of the promise (then it should call \"$stateChangeStart\" for the new state as usual).\r\n\r\nNote the stateChangeStart is on the root controller. \r\n\r\nPs. im trying to check if a local user object exists and if not, it will check a rest api to see if a user session exists and fetches the user data. This is so i dont have to put ressolve methods on every state, instead a simple flag indicating that the user must be logged in to view this state.\r\n\r\nThanks in advance.\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/angular-ui/ui-router/issues/comments/90226674","html_url":"https://github.com/angular-ui/ui-router/issues/1399#issuecomment-90226674","issue_url":"https://api.github.com/repos/angular-ui/ui-router/issues/1399","id":90226674,"user":{"login":"nateabele","id":18288,"avatar_url":"https://avatars.githubusercontent.com/u/18288?v=3","gravatar_id":"","url":"https://api.github.com/users/nateabele","html_url":"https://github.com/nateabele","followers_url":"https://api.github.com/users/nateabele/followers","following_url":"https://api.github.com/users/nateabele/following{/other_user}","gists_url":"https://api.github.com/users/nateabele/gists{/gist_id}","starred_url":"https://api.github.com/users/nateabele/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nateabele/subscriptions","organizations_url":"https://api.github.com/users/nateabele/orgs","repos_url":"https://api.github.com/users/nateabele/repos","events_url":"https://api.github.com/users/nateabele/events{/privacy}","received_events_url":"https://api.github.com/users/nateabele/received_events","type":"User","site_admin":false},"created_at":"2015-04-06T20:12:09Z","updated_at":"2015-04-06T20:12:09Z","body":"@paulflo150 Soon. :-)"}}