Tuesday, July 16, 2019

How may I go to the API and back to check something in a CanActivate guard in an Angular 7 application?

You may make the canActivate method in a CanActivate guard return Promise<Boolean> instead of Boolean for handling the asynchronous stuff. Honestly however, I don't see why you would not just use a synchronous old school XHR call in the guard as everything has to wait on the guard anyway.

No comments:

Post a Comment