Angular2: Global Guard (user has to be logged in always)
问题 I'm building an application where there's no access at all for unauthenticated users. I wrote a LoggedInGuard , but now I have to add canActivate: [LoggedInGuard] to every route inside my router configuration (except the LoginComponent ). Is there a better way to get this working? My file / module layout looks like this: app/ AppModule AppRoutingModule AppComponent authentication/ AuthenticationModule AuthenticationRoutingModule LoginComponent contacts/ ContactsModule ContactsRoutingModule