I want to send a parameter from app.run to my loginController. Because, I call a state.go() from the $rootScope.$on() defined inside the app.run.
app.run('$rootScope', '$state', '$stateParams',function($rootScope, $state, $stateParams(){
    $rootScope.$state = $state;
    $rootScope.$stateParams = $stateParams;
    $rootScope.$on('unauthorized_access', function (event, args) {
        $state.go("page.login", {'error': args.error,'msg': args.msg});
    });
}]);
I have
app.config(['$stateProvider','$urlRouterProvider',function($stateProvider, $urlRouterProvider, $httpProvider){
    $urlRouterProvider.otherwise('/');
    $stateProvider
    // some parts omitted...
    .state('page.login', {
        url: '/login',
        views: {
            'page': {
               templateUrl: 'app/landingPage/login.html',
                controller:  'loginController',
                params: {obj : {error : null, message: null} }
           }
        }
    });
}]);
and I want to pass parameters to the loginController from app.run, through $state.go() during transition.
    $state.go("page.login", {'error': err,'message': msg});
and in my controller, this is how I am trying to receive the params...
app.controller('loginController',['$scope', '$state', '$stateParams',   function($scope, $state, $stateParams){
    console.log($stateParams.obj);
}]);
I do not want to change the url to >> url: '/login/:params' etc. in stateProvider
I referenced this page : stackoverflow example
but,was not helpful. Any help is appreciated. Apologies for my poor communication.
 
    