How can I enable html 5 mode for Angular JS?
'use strict'
var blogApp = angular.module('blogApp', ['ngRoute'])
.config(['$routeProvider', function ($routeProvider, $locationProvider) {
$routeProvider.when('/disclaimer', { templateUrl: 'templates/disclaimer.html', controller: 'DisclaimerCtrl' });
$routeProvider.otherwise({ redirectTo: '/' });
$locationProvider.html5Mode(true);
}]);
When I add the line about html5mode, I get the following JS error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module blogApp due to:
TypeError: Cannot read property 'html5Mode' of undefined
I'm using Angular 1.2.15 on IIS
config(['$routeProvider',
is missing $locationProvider
declaration on the array.
.config(['$routeProvider','$locationProvider', function ($routeProvider, $locationProvider) {
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