I created an Initializer
like this
import { AuthService } from "./auth-service";
export function AuthInitializer(auth: AuthService) { return () => auth.isAuthenticated() };
and registered like this in core.module
providers: [
{
provide: APP_INITIALIZER,
useFactory: AuthInitializer,
deps: [AuthService],
multi: true
}]
this is working perefectly.
CLICK HERE to find out more related problems solutions.