I am using token auth and currently if a user is not signed in they are directed to the url path of '/login', I want to allow users to go to the path '/createUser'. The code below is what directs users to the login page if they are not logged in. How would I allow users to navigate to the '/createUser' path if they are a new user?
angular.module('Demo', [
'ngRoute'
]).run(function(
$rootScope,
$location,
$http,
$window,
AuthFactory,
UserFactory,
TitleFactory,
SkillsFactory
) {
$rootScope.$on('$routeChangeStart', function(event, next) {
console.log(next);
if (AuthFactory.isAuthenticated()) {
$http.defaults.headers.common['Authorization'] = 'Token token=' + $window.sessionStorage.getItem('demo.user');
UserFactory.fetch();
TitleFactory.fetch();
SkillsFactory.fetch();
} else {
$location.path('/login');
}
});
});