I am trying to use angularJS UI routing. I have three webpages, clients can access the first page through some link but if the url has a token attached to it I am doing a $state.go('second-page') in the controller. If the token is null I keep the client on the first page. However I want that when the client presses the back button on the browser the client should go to the first page. Which does not happen.
So the scenario is
client comes through the link
'#/form/calendar/:officeId/:token'
and since the token is not null I transition to the second page which does not have a URL the URL now becomes
'#/form/'
but when the client presses the back button it tries to go to
'#/form/calendar/:officeId/:token'
which results in a cyclic transition to the second page and the client can never reach the first page.
Please advise on how to avoid this.
Thank You