I have simple angularjs application and I believe I did not configure the routing the right way because in the browser the url looks weird. For example when I access my index.html page this is the url: http://localhost:8082/basic-web-app/app/index.html#/ and when I navigate to another pages within the app it appends the location after index.html#/: http://localhost:8082/basic-web-app/app/index.html#/login Every example I checked was without index.html and appending the location like http://localhost:8082/basic-web-app/app/ and http://localhost:8082/basic-web-app/app/login My routing:
coursesApp.config(function($routeProvider, $httpProvider) {
$routeProvider
// route for the home page
.when('/', {
templateUrl: 'pages/home.html',
controller: 'mainController',
controllerAs: 'controller'
})
// route for the courses page
.when('/courses', {
templateUrl: 'pages/courses.html',
controller: 'coursesController'
})
// route for the courses page
.when('/login', {
templateUrl: 'pages/login.html',
controller: 'loginController',
controllerAs: 'controller'
})
.when('/profile', {
templateUrl: 'pages/profile.html',
controller: 'profileController'
});
$httpProvider.defaults.headers.common["X-Requested-With"] = 'XMLHttpRequest';
});
thank you!
index.htmlshould be outside the app folder. then run your app as,http://localhost:8082/basic-web-app/app