0

I have a angular application in wamp in a subfolder.

When i go to http://myapp.dev/angular/myapp i'm getting the 404 view instead of the home view. What did i miss here?

thanks,

runConfig.$inject = ['$stateProvider', '$urlRouterProvider', '$locationProvider', '$provide'];
function runConfig($stateProvider, $urlRouterProvider, $locationProvider, $provide) {

    $stateProvider

        .state('home', {
            url: '/',
            controller: 'HomeController',
            controllerAs: 'vm',
            templateUrl: 'components/home/homeView.html'
        })
        .state('404', {
            templateUrl: 'tpl/404.html'
        });

    $urlRouterProvider.otherwise(function ($injector, $location) {
        var $state = $injector.get('$state');
        $state.go('404');
        return $location.path();
    });

    $locationProvider.html5Mode(true);
Brian Millot
  • 179
  • 1
  • 12
  • You only have 2 states `home` and `404`, neither of which point to your url. So your `.otherwise` is executed instead pointing to `404` state. Beyond that you are using `html5Mode`, which can break your routing [unless handled properly](https://stackoverflow.com/questions/22739455/htaccess-redirect-for-angular-routes) – Aleksey Solovey Feb 20 '18 at 13:44
  • Also I don't see why not just redirect with `$urlRouterProvider.otherwise('tpl/404.html');` – Aleksey Solovey Feb 20 '18 at 13:50

0 Answers0