Skip to content Skip to sidebar Skip to footer

Angular.js: Cannot Set Default Route When No Hash

The problem is: I cannot reach home page when url is www.some.com but can when it's www.some.com/#! or www.some.com/#!/ I was define default web app route: $routeProvider.when('',

Solution 1:

Try setting the < base > tag.

<head><basehref="/"></head>

Have a route defined for home

.when('/home', {
        templateUrl: pathToIncs + 'home.html', 
        controller: 'homeController'
 })

using redirectTo on the "/"

.when('/', {
    redirectTo: '/home'
})

along with the .otherwise

.otherwise({
    redirectTo: '/home'
});

Post a Comment for "Angular.js: Cannot Set Default Route When No Hash"