angularjs dealing with two spas and routeprovider

angularjs dealing with two spas and routeprovider  using -'angularjs,single-page-application'

I have two SPAs: one has <base href="/"> and other has <base href="/dashboard/">

And I am deploying these applications as separate war files in tomcat server. So far this is working good.

Let's have a look in my code (second app config i.e for /dashboard/):

myApp.config(['$routeProvider','$locationProvider', function($routeProvider, $locationProvider) {

    $routeProvider.when('/events', {
        templateUrl: 'event-list/event-list.html',
        controller: 'eventListCtrl'

    $routeProvider.when('/', {
        templateUrl: ' ',
        controller: ['$scope','$location', function($scope,$location) {
            $location.replace(); // problem #1

    $routeProvider.otherwise({redirectTo: '/404'}); // problem #2

Problem #1

As you can see in code, I want to redirect the URL http://localhost/dashboard to http://localhost/dashboard/events by default. But this configuration is giving me maximum call stack exceeded error in browser console.

Problem #2

I already have 404 page in my first app i.e. at http://localhost/404 location. But my current configuration is redirecting me to http://localhost/dashboard/404. I want to reuse my 404 page.

Please guide me in right direction. Thanks.

asked Oct 6, 2015 by vibhorsingh
0 votes

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.