Best Practice on startup

Hello All,

I’m new to Ionic and I was looking to get some feedback on best practice.

Currently in my app, the user has to click “Create profile” from the side menu to create their profile. What I want to do is check localStorage on startup (first page) to see if they have a profile, and if so, automatically display the “Create profile” modal. If they do have a profile, and the time is x, display view 1. If they do have a profile and the time is y, display view 2.

if ( userNotExists )
DisplayCreateProfileModal;
end if

if ( userExists )
if ( time == x )
DisplayView1;
elseif ( time == y )
DisplayView2;
end if

What is the general pattern you would use to achieve this?

use a resolve/promise on the main controller… if the promise is rejected, the display the create profile modal.

https://thinkster.io/egghead/resolve-conventions