0

Maybe it's something simple, but this is the first time I'm using the angular-ui-router. I'm using html5 mode and I've got the following states configured:

    $locationProvider.html5Mode(true);

    $authProvider.loginUrl = API_LOCATION + 'authenticate';

    $urlRouterProvider.otherwise('/auth');
    
    $stateProvider
        .state('auth', {
            url: '/auth',
            templateUrl: TEMPLATES_LOCATION + 'login.html',
            controller: 'AuthController as auth'
        })
        .state('country', {
            url: '/country',
            templateUrl: TEMPLATES_LOCATION + 'country.index.html',
            controller: 'CountryListController'
        })
        .state('country.select', {
            url: '/select',
            templateUrl: TEMPLATES_LOCATION + 'country.select.html',
            controller: 'CountrySelectController'
        })
        .state('country.edit', {
            url: '/:isoCode',
            templateUrl: TEMPLATES_LOCATION + 'country.edit.html',
            controller: 'CountryEditController'
        });

All country routes load country.index.html and CountryEditController. Why?

EDIT

my .htaccess file (the angular app is in a subfolder named "admin")

RewriteEngine on

#RewriteBase /admin/ <- tried this too

RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^(.*) /admin/index.html [NC,L]
13
  • Have you tried MYSITEURL/#/country ? Commented Feb 11, 2016 at 16:16
  • I'm using html5 mode, forgot to mention that. Commented Feb 11, 2016 at 16:17
  • 1
    You need to add an htaccess to your server (url rewriting) to make it working Commented Feb 11, 2016 at 16:18
  • I am sure if you do <a ui-sref="country">Country Link</a> it will work Commented Feb 11, 2016 at 16:20
  • Question updated, maybe by .htaccess is not configured well. Btw your second comment doesn't solve the issue on browser page refresh (which is a common user action). Commented Feb 11, 2016 at 16:23

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.