A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://stackoverflow.com/questions/17200231/how-to-set-default-url-route below:

angularjs - How to set default URL/route?

I'm implementing AngularUI's routing and appear to be missing something about how to configure a default URL. It seems like the below code would default the user to /dashboard/tree but if I refresh the page, the url appends another /dashboard, so I end up with /dashboard/dashboard/dashboard/dashboard/tree.

How can I properly set the default URL without having this appending issue when the user first visits the page?

config(['$urlRouterProvider', '$stateProvider', function($urlRouterProvider, $stateProvider) {
    $urlRouterProvider.otherwise('/dashboard/tree');

    /* URL mappings */
    $stateProvider.
        state('dashboard', {
            url: '/dashboard',
            views: {
                'page': {
                    templateUrl: '/partials/admin/dashboard.htm'
                }
            }
        }).
        state('dashboard.tree', {
            url: '/tree',
            views: {
                'content': {
                    templateUrl: '/partials/admin/tree-overview.htm'
                }
            }
        });
}])

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4