Dennis
Dennis

Reputation: 368

ui router, start view when loading page

This might be a stupid question but I can't find a way to just display the view when the page is loaded only when I dont put manual '/#/' to it.

But I just wanna dispaly it on 'http://localhost:8080/dist/'

Here is my config

app.config(function($stateProvider, $urlRouterProvider) {

    $stateProvider
    .state('', {
        url: '',
        views: {
            "menu-view": {
                templateUrl: "partials/menu.html"
            },
            "map-view": {
                templateUrl: 'partials/floors/floor-1.html'
            }
        }
    })
});

Upvotes: 0

Views: 44

Answers (1)

Daniel
Daniel

Reputation: 6481

As suggested by dfsq, use html5 mode:

app.config(function($stateProvider, $locationProvider, $urlRouterProvider) {

$locationProvider.html5Mode(true);

$stateProvider
    .state('', {
        url: '',
        views: {
            "menu-view": {
                templateUrl: "partials/menu.html"
            },
            "map-view": {
                templateUrl: 'partials/floors/floor-1.html'
            }
        }
    })
});

Upvotes: 1

Related Questions