Rites Bless
Rites Bless

Reputation: 33

How can I hide the hash route in Angularjs

I would like to keep the integrity of the hash like for breadcrumbs and such but i just don't want to display the hash in the route. Is there any way to keep the hash in the background but hide it in the URL? I have done some research on this already and I have found some answers that all get rid of the hash completely. Any help would be appreciated. Thank you.

Upvotes: 3

Views: 63

Answers (1)

StackSource
StackSource

Reputation: 26

angular.module('scotchy', [])

.config(function($routeProvider, $locationProvider) {

    $routeProvider
        .when('/', {
            templateUrl : 'partials/home.html',
            controller : mainController
        })
        .when('/about', {
            templateUrl : 'partials/about.html',
            controller : mainController
        })
        .when('/contact', {
            templateUrl : 'partials/contact.html',
            controller : mainController
        });

    // use the HTML5 History API
    $locationProvider.html5Mode(true);
});

Read this blog, it should have every thing you need to know. Pretty URLs

Upvotes: 1

Related Questions