1

I made a simple one page app with angular.js. And ui-router was used.

The output url:

example.com/index.html#/profile

But I want like this:

example.com/profile

How can I solve this problem?


simple router code added

app.config(['$stateProvider', function($stateProvider) {
    $stateProvider.state('profile', {
        url: "/profile",
        templateUrl: "views/profile.html",
        controller: "ProfileCtrl",
        resolve: {
            deps: ['$ocLazyLoad', function($ocLazyLoad) {
                return $ocLazyLoad.load({
                    name: 'app',
                    insertBefore: '#ng_load_plugins_before', // load the above css files before '#ng_load_plugins_before'
                    files: [
                        'controllers/profile.js'
                    ]
                });
            }]
        }
    });
}]);
0

1 Answer 1

1

Set Html5 mode true in your app.js

$locationProvider.html5Mode(true);

Sign up to request clarification or add additional context in comments.

1 Comment

If I set the html5mode, how can I set server side route?

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.