Subscribe
Notify of
guest
9 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
DigCrt

All great thanks!!!

Federico

The big issue with this approach (that is the same that i saw in many others tutorials, btw) is that authguard check BEFORE that autentication service even be created, so if you refresh the page the first thing you say is app root (whatever it is, in my case login page) and only AFTER will subscribe for changing in authState (that will be fired in constructor service itself). Basically, login page appears for 1 sec or so. And i don’t like it.

Kamlesh

Thank you for nice article. This example working fine.

But, How I can handle hardware back button on login page after user logged in, both in sidebar and tabs page application. In device after login success tabs page comes than after press back button than login page show again ๐Ÿ™

I tried to add a new authGaurd for login page, but blank page comes for few sec.

How can handle this? Please post a example.

Thanks,
Kamlesh

juhee

Thank you. But there’s an error. Why is that? I did the same thing.
Error: StaticInjectorError(AppModule)[AuthGuardService -> AuthenticationService]:
StaticInjectorError(Platform: core)[AuthGuardService -> AuthenticationService]:
NullInjectorError: No provider for AuthenticationService!

Mary User

Thanks, nice simple explanation.
How would you handle different access Levels? e.g. in WordPress you have Admin, Authors etc.

Say I have Level 1, Level 2, Level 3 users how would I save, and use their access level using this technique?