Join Alexander Zanfir for an in-depth discussion in this video Show logout in our navbar, part of MEAN Stack and MongoDB: Development Techniques.
- [Voiceover] In this video, we will…show a log out button, instead of…the login button, if we are already logged in.…We can determine if we are logged in…by looking at the localStorage for a token.…But Satellizer makes it easier for us by…providing an isAuthenticated function.…The first thing we need to do is…create a controller for our navView.…Since it didn't have any functionality…until now, it did not need a controller,…but we will now have to check if we…are authenticated to modify what…button we are showing in the navbar.…
So, let's navigate to components, and then navbar.…And now let's create a new file.…We'll call it navbar.controller.js.…And now let's export a class called NavbarController.…And next, let's create a constructor.…And we'll inject the auth service…so that we have access to Satellizer.…And as usual, we'll use ngInject,…since we are injecting a service.…
Now, let's open up our navbar.html.…Inside here, we can add an ngController directive,…since we won't be setting up the controller…with our router, as we did for the other views.…
Author
Released
7/14/2016- Installing and setting up your MEAN toolset
- Making an Angular post form
- Sending posts
- Displaying messages
- Creating a registration form
- Saving users
- Associating users with posts
- Authenticating users at login
Skill Level Intermediate
Duration
Views
-
Introduction
-
Welcome55s
-
What is the MEAN stack?3m 39s
-
-
1. Setup
-
Install Node55s
-
Install the Brackets IDE2m 8s
-
Install Mongo2m 19s
-
Install Git43s
-
Install Yeoman1m 25s
-
Set up a Git repository2m 9s
-
Set up an app design2m 24s
-
-
2. Message Posting
-
3. Display Messages
-
4. Registration
-
Save a user with Mongo13m 26s
-
5. Logging In
-
Set up Satellizer for login1m 32s
-
Show logout in our navbar3m 45s
-
-
Conclusion
-
Next steps2m 5s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Show logout in our navbar