How to execute in first a function and in second canActivate()

后端 未结 1 1843
挽巷
挽巷 2020-12-21 10:37

I have this AuthGuard. In this code I want to create a condition. If my resetpasss is not null I want to navigate in here ResetPassIdComponent else I want to navigate in Log

相关标签:
1条回答
  • 2020-12-21 11:01

    You can add the condition in CanActivate() itself. Can you tried like the below?

    canActivate(): boolean {
        this.geturl();
        if (this.auth.isAuthenticated()) {
            return true;
        } else if(this.resetpasss){
           this.router.navigate([this.myappurl]);
        }else{
            this.router.navigate(['/outsidelogin/login']);
        }       
    }
    
    0 讨论(0)
提交回复
热议问题