How to program the entrypoint module of the app depending on some config


Hi, i want to know if I can start the application in a specific module depending on some setting on the application-settings module. For example lets suppose I have a setting “logged” in appSettings;

if(appSettings.getBoolean("logged")) {
    app.start({ moduleName: 'main-page' });
} else {
   app.start({ moduleName: 'login' });

Something like that. I mean I want to navigate to some view if the user is logged, if not, to navigate to another.
I thought to use a module that worked as a router, the app would start in that module an then from there would navigate to the view depending on the config.
Any idea?


For me I used more complicated logic that involve http call at the app start, so for that I used a router page; however, for your case since its a simple true false check, then I think the above code should be sufficient.


Yes, the problem is that once the app is started, having the user logged, in a certain module and the user logged out, when (s)he restarts the app, if the app is still in memory, it will skip the entrypoint and go directly to the module previously started when the user was logged, and occurs that the user is not. I tell because I tried this way and happened this.


How I’m managing this is that, I always take the user to a main page, that has a activity indicator, and then I perform the navigation logic there.

Keeping navigation logic in app.js didn’t work for me either.


Okay, I did that too, I just wanted to know if there was another way. Thanks!!