I'm working on a project Using AngularJS as front-end and Spring MVC as back-end. Also I used plugin ui-router. The base url looks like localhost:8080/PROJECT_NAME/#! For a better looking I'm trying to remove the /#!/ from url.
I failed to get a correct result from the common solution from internet:
// Insert this into Angularjs module config file
$locationProvider.html5Mode(true);
// Add this into META tag
<base href="/">
After doing this what I got is all resources crashed, so I added my project name:
<base href="PROJECT_NAME">
Resources are correctly fetched, however, the log shows:
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
(anonymous function) @ angular.js:68
(anonymous function) @ angular.js:4756
forEach @ angular.js:357
loadModules @ angular.js:4717
createInjector @ angular.js:4639
doBootstrap @ angular.js:1838
angular.resumeBootstrap @ angular.js:1867
maybeBootstrap @ hint.js:569
I don't know what to do next, may need your help, thanks!
Router code:
app.config(
function ($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise("/");
$stateProvider
.state('index', {
url: "/",
templateUrl: "homeview"
});
// use the HTML5 History API
$locationProvider.html5Mode(true);
}
);