Тёмный

CanActivate Route Guard in Angular | Angular Route | Angular 13+ 

procademy
Подписаться 51 тыс.
Просмотров 23 тыс.
50% 1

The Angular CanActivate route guard runs before we navigate to a route allowing us to cancel the navigation. In this lecture, you will learn what is CanActivate route guard and how to use it to protect the route.
The Angular CanActivate guard decides, if a route can be activated ( or component can be rendered) or not. We use this guard, when we want to check on some condition, before activating the component or showing it to the user. This also allows us to cancel the navigation if the condition fails.
One of the use case of this CanActivate route guard is to check if the user has logged in to the application or not. If user has not logged in, then the CanActivate route guard can redirect him to login page.
In this lecture you will learn:
1. What is CanActivate Route Guard?
2. Where to use CanActivate Route guard?
3. How to implement CanActivate Route guard to protect a route.
DOWNLOAD SECTION SOURCE CODE HERE: drive.google.com/file/d/16SYO...

Опубликовано:

 

20 мар 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 18   
@SrinathJog
@SrinathJog Год назад
can activate is deprecated in angular/router in angular 15+ . So please use can activate as interface now export declare interface CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree; } @Injectable() export class AuthGuard implements CanActivate {}
@GamBar64
@GamBar64 Год назад
Great vid, route guards are easy!
@nivethan2728
@nivethan2728 Год назад
Can you please post a video on how to implement the same functionality without using the deprecated canActivate
@kmdazar
@kmdazar Год назад
Thanks for nice explanation on 'canActivate', also can you please explain on 'canLoad' and 'resolve' ?
@silvertoothdevlog6102
@silvertoothdevlog6102 Год назад
What if we were subsribed to the boolean value of the authentication in courses page ? Could this result in a dynamic response when logout is clicked the user would be redirected to the home page automatically ?
@gladisxavier2430
@gladisxavier2430 Год назад
Sir need ur help in CourseGuardService when i put canactivate to 'false' in the navigation bar allow to view the hoem page.follow all ur steps pls guide me which place i did mistake.if i give canactivate true or false in my navigation bar is not respond pls guide me sir
@ramzirihane3612
@ramzirihane3612 2 года назад
please i need some help , i try with this but it not work
@nailiridha7179
@nailiridha7179 Год назад
good good good
@ambikadh5720
@ambikadh5720 3 месяца назад
Nice vedio on canActivate route guard
@mmashabanemogoboya7686
@mmashabanemogoboya7686 2 года назад
I wanna implement the same guards in ionic angular but its not working, after loging in it should redirect to home page but it stays on login
@procademy
@procademy 2 года назад
Can you share the code for CanActivate route which you have implemented.
@procademy
@procademy 2 года назад
Are you first returning true and then navigating the user??
@lakshithakanchana6155
@lakshithakanchana6155 Год назад
@procademy "CanActivate" guard is deprecated from the start of the Angular 15. But I do not understand the method to resolve it at all. Please update this video.
@arammah
@arammah Год назад
just don't implement your class to interface of CanActivate;just use canActivate method as well as before.
@lakshithakanchana6155
@lakshithakanchana6155 Год назад
@@arammah Thanks. Then what is CanActivateFn?
@arammah
@arammah Год назад
@@lakshithakanchana6155 canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree
@lakshithakanchana6155
@lakshithakanchana6155 Год назад
@@arammah thanks Aida.
Далее
Этот Пёс Кое-Что Наделал 😳
00:31
다리에 힘이 풀려버린 슈슈 (NG Ver.)
00:11
Просмотров 2,5 млн
Subjects in RxJS | Observables | Angular 12+
16:14
Просмотров 53 тыс.
Cool Tech You’ll LOVE!
21:41
Просмотров 64 тыс.
CanActivate Route Guard - Angular (Tutorial #24)
11:58
[Hindi] JIT vs AOT | Learn for Angular Interviews
8:03
Pipes in Angular | Angular Pipes | Angular 13+
14:15
Просмотров 14 тыс.