I am using angularjs framework in my website.
I have a problem with urls! There is # in urls in Google analytics
I am using Html5Mode in my config.js
app.config(function($httpProvider, $analyticsProvider, $locationProvider) {
$httpProvider.defaults.withCredentials = true;
$httpProvider.interceptors.push('TokenInterceptor');
$analyticsProvider.firstPageview(true); /* Records pages that don't use $state or $route */
$analyticsProvider.withAutoBase(true); /* Records full path */
$locationProvider.hashPrefix('!');
$locationProvider.html5Mode(true);
});
it is some part of my routes.js:
app.config(['$locationProvider', "$routeProvider",
function($locationProvider, $routeProvider) {
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
var modulesPath = 'modules/';
$routeProvider
.when("/", {
title: '',
templateUrl: modulesPath + "site/views/index.html",
access: {
requiredLogin: false
}
}).when("/index", {
redirectTo: "/",
access: {
requiredLogin: false
}
}).when("/home", {
redirectTo: "/",
access: {
requiredLogin: false
}
}).when("/terms", {
title: 'Terms and Conditions',
templateUrl: modulesPath + "terms/views/index.html",
access: {
requiredLogin: false
}
I tried several ways like adding $locationProvider.html5Mode(true);
plase help me to fix it thank you