I am using AngularJS to create a Single Page Application (mobile app). The code below allowed me to successfully inject the home page with a login module upon click off a button:
$("#loginButton").click(function() {
location.href='#login';
});
However, I later decided to automatically navigate the user to a login page if a login was not detected, and a navigation page if it was detected. When I switched to:
$(document).ready(function() {
location.href='#login';
});
I received the following error:
TypeError: Cannot read property 'charAt' of undefined at Object.LocationHashbangUrl.$$parse (https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.js:8708:40)
I was wondering why I received this error, and what is the appropriate way to send a user to either 1 of 2 pages upon loading of the app.