I'm having (albeit minor) issues with $routeProvider
.
http://localhost/thisapp/ works fine, and redirects to the .otherwise()
perfectly. But it seems that once the app is loaded and lands on the "home" url (http://localhost/thisapp/#/)
Then it breaks.
If I navigate to http://localhost/thisapp the $location
resolves to http://localhost/thisapp/#/
If I refresh (because you know a user will do that), then the code breaks
I've tried using $locationProvider
but that's even more confusing. It seems the more I read up on it, the more confused I get because what's documented doesn't seem to work. (If I uncomment the $locationProvider
line below, nothing generates). I've looked at various tutorials and issues on StackOverflow, but doesn't work as it seems to be supposed to.
Here's my config code:
myApp.config(function($routeProvider, $locationProvider) {
// commented cuz it's not working
// $locationProvider.html5Mode(true);
$routeProvider
.when('/', {
templateUrl: 'app2/components/templates/overview.html',
controller: 'overviewController'
})
.when('/all_overview', {
templateUrl: 'app2/components/templates/overview.html',
controller: 'overviewController'
})
.when('/all_procurement', {
templateUrl: 'app2/components/templates/procurement.html',
controller: 'procurementController'
})
.when('/all_social', {
templateUrl: 'app2/components/templates/social.html',
controller: 'socialController'
})
.when('/all_strengthening', {
templateUrl: 'app2/components/templates/strengthening.html',
controller: 'strengtheningController'
})
.when('/all_sales', {
templateUrl: 'app2/components/templates/sales.html',
controller: 'salesController'
})
// otherwise go to all_overview
.otherwise({
redirectTo: '/all_overview'
});
});