#Need to reload component manually

12 messages · Page 1 of 1 (latest)

scarlet fable
#

Hello, I created a dynamic header that change following a condition => if there is a connected User Id in localstorage or not.
The problem is that I need to reload the page manually so that the header change.

real sentinel
scarlet fable
#

so that's the only way right ?

real sentinel
#

"only" no, there are many. But Angular uses Observables, and so Observables are a thing to use in Angular.

scarlet fable
#

ah okay. Thanks ^^

real sentinel
#

You should probably have an AuthService that tracks if the User is logged in using an Observable. And your AuthService probably should use an Auth library instead of trying to make your own. Unless this is for your school project or something

scarlet fable
#

yes exactly it's for a school project. I am learning

real sentinel
#

g!toh @scarlet fable The tutorial apps in the Angular Guide have an example of setting up an authenticated section of your app. If you haven't already built the tutorial apps then I highly recommend that you do so because they give you an overview of some of what Angular can do and how it does it.

spare heraldBOT
#

@scarlet fable The place we recommend starting your Angular journey is with the Tour of Heroes tutorial, located here https://angular.io/tutorial.

scarlet fable
#

yes noted

#

thank you so much sir

chrome shuttle