Posted On: Feb 22, 2018
html5Mode method of $locationProvider module is used to enable HTML5 mode in Angular 1.x. For creating pretty URLs and removing # from URLs html5Mode need to true.
Enabling html5Mode to true in Angular 1.x.
angular.module('myApp', [])
.config(function($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl : 'partials/home.html',
controller : mainController
})
// use the HTML5 History API
$locationProvider.html5Mode(true);
});
Never Miss an Articles from us.
Explain the architecture of AngularJS?..
What is the Template in AngularJS?..