I'm working on a project involving building a hybrid app using Angular JS routing that needs to authorise users to get data from salesforce. However to issue I had was that salesforce gives the access token in the URI which the AngulalJS routing picks up as a malformed address and throws the routing out of whack.

To solve this I have attempted to make a standalone, un-routed, login page that sends users to salesforce to login and allow the app access after which they are send back to the login page. This login page runs a script that grabs the URI parameters and stores them as variables then checks the address for a '#' symbol indicating that the page has been redirected back after login and then should send the user into the body of the app. The problem is the redirect into the body of the app isn't triggering dispite getting a full URI back after logging in through salesforce.

I probably should be storing the values as an array rather than calling the the function 7 times, but incredibly poor javascript aside (I am very new to this) what have a I missed that means the page is failing to redirect?