Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

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

Related Hot Questions

Government Jobs Opening