I have a Django web application serving an Angular JS client application.
My URL tree looks like this:
> /
> /admin/
> /login/
> /logout/
> /static/
> /admin/
My Angular application's base URL is /admin/
, and its static content lives in /static/admin/(js|css|views)
.
Here's the configuration for the route provider:
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/admin/', {
controller: 'IndexController',
templateUrl: '/static/admin/views/index.html'
}).otherwise({ redirectTo: '/admin/' });
});
app.config(['$locationProvider', function($locationProvider) {
$locationProvider.html5Mode(true);
});
I have a few problems here. The first problem is URL flexibility. What if I decide to move my base URL to something like /angularadmin/
? I'll have to rewrite a lot of JavaScript and a lot of <a>
links. The second problem is that when
I provide a link to /logout/
, this link hits the otherwise
clause and redirects back to /admin/
.
How do I tell Angular to pass through links to /logout/
and how can I make configuration of the base URL here much more flexible?