I would like to ask how to stop loading application. I need this for showing modal window with login form. My idea is: User go to my webpage, first start LoginController which check if user is authenticated. If not, it displays the form but must be stopped loading next controllers and components (loading data by user id). Here is my concept:
<body ng-controller="LoginController">
controllers, components...
</body>
app.controller("LoginController", function LoginController(){
this.$onInit = function(){
if(!authenticated()){
showLoginModal();
stopLoadingApp(); // what will be implementation?
}
}
})
I tried this, but not called:
app.controller("LoginController", function LoginController($rootScope){
$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
event.preventDefault(); //not called
});
});
Please help me how to solve this problem. Thanks