Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have an web application where we show a set of values on UI which has button named 'view schedule'. When clicked on 'view schedule' button, we make a redirection to viewSchedule controller which shows the ui-grid tables.

The issue is that when clicked on 'view schedule' button, the web application logs out automatically and redirected to login page.

Why routing to login page is because in app.js file, routing is made to login page in urlRouterProvider if no route is found.

I have pasted the code below:

app.js

    angular.module('app').config(['$urlRouterProvider', '$httpProvider', function($urlRouterProvider, $httpProvider, IdleProvider) {
        $urlRouterProvider.otherwise('/login');
}]);

HTML :

    <div class="col-md-2">
        <button type="button" class="btn btn-tm view-plan-btn" ng-click='approval.viewSchedule()'>View
        Schedule
        </button>
    </div>

Controller :

me.viewSchedule = function() {
            toastr.clear();
            var url = $state.href('fullview.viewSchedule', {
                id: campaign.campaignId
            });
            window.open(url, '_blank');
        };
share|improve this question
    
Where do you have the routing mapped for viewSchedule. I think as it is not found, it takes you to the default routing which is the /login – CrazyMac Jan 18 at 5:57
    
@CrazyMac : Thanks for the reply var viewSchedule = { name: 'fullview.viewSchedule', url: '/campaign/:id/viewSchedule', templateUrl: 'src/skynet/campaign_schedule/view/viewSchedule.html', controller: 'viewScheduleController', cache : false }; $stateProvider..state(viewSchedule); Mapping is given in stateProvider of config file. – Prashanth K R Jan 18 at 6:01
    
Are you sure the calling URL pattern and the mapping is same. Please dump the calling URL pattern and compare it against your mapping – CrazyMac Jan 18 at 6:04
    
please add your route configuration to the question. – Sravan Jan 18 at 6:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.