How to hide hash route in Angularjs

I would like to preserve the integrity of the hash, for example for breadcrumbs, etc., but I just don't want to display the hash on the route. Is there a way to keep the hash in the background but hide it in the URL? I've already done some research on this and I've found several answers that get rid of the hash entirely. Any help would be greatly appreciated. Thank.

+3


source to share


1 answer


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 everything you need to know. Pretty URL

+1


source







All Articles