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

Поділитися
Вставка
  • Опубліковано 26 жов 2024

КОМЕНТАРІ • 18

  • @nivethan2728
    @nivethan2728 Рік тому +2

    Can you please post a video on how to implement the same functionality without using the deprecated canActivate

  • @SrinathJog
    @SrinathJog Рік тому +3

    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 {}

  • @kmdazar
    @kmdazar Рік тому

    Thanks for nice explanation on 'canActivate', also can you please explain on 'canLoad' and 'resolve' ?

  • @GamBar64
    @GamBar64 Рік тому

    Great vid, route guards are easy!

  • @ambikadh5720
    @ambikadh5720 6 місяців тому

    Nice vedio on canActivate route guard

  • @silvertoothdevlog6102
    @silvertoothdevlog6102 2 роки тому

    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 2 роки тому

    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

  • @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 Рік тому +1

      @@lakshithakanchana6155 canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree

    • @lakshithakanchana6155
      @lakshithakanchana6155 Рік тому

      @@arammah thanks Aida.

  • @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??

  • @nailiridha7179
    @nailiridha7179 2 роки тому

    good good good