I am trying to use angular's $locationProvider.html5mode() to removed the "#" in URLs, but for some reason it always throws an error that html5mode is undefined. I tried logging $locationProvider in the console to inspect its properties and html5mode is present but when I try invoking it, it throws an error that its undefined. Has anyone experience this before and wouldn't mind shedding some light on what I am missing. Thanks in advance.
var app = angular.module('app', ['appControllers', 'ngRoute']);
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
    $locationProvider.html5mode(true);        
    $routeProvider
        .when('/', {
            templateUrl: 'partials/home.html',
            controller: 'PageController'
        })
        .when('/app', {
            templateUrl: 'partials/app.html',
            controller: 'PageController'
        });
}]);
                You typed incorrect method name. Change
$locationProvider.html5mode(true);        
to
$locationProvider.html5Mode(true);        
with M uppercase in word mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With