I am encountering an issue with my AngularJS application that does not contain any nodeJS code. The problem lies in removing the # from the URL and I have implemented ui-routes for routing.
'use strict';
var app = angular.module('myapp', ['ui-router']).
config(['$stateProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$stateProvider.
state('home', {
url: '/',
templateUrl: 'views/index.html'
})
.state('where-am-i', {
url: '/where-am-i',
templateUrl: 'views/where_am_i.html',
controller: 'mainCtrl'
})
.state('audience', {
url: '/audience',
templateUrl: 'views/audience.html',
controller: 'mainCtrl'
});
}]);
In addition, I have added a base tag to the head section of my index.html file.
<base href='/' />
Despite trying to require no base, I still cannot get it to work properly.
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
When adding the base tag, I encounter 404 errors for all the assets included in the index.html file.
I am seeking a quick and simple solution to this issue.
Thank you in advance!