Use auth service for login and logout
–home.component.html
<button class="btn btn-primary" (click)="onLogin()">Login</button> <button class="btn btn-primary" (click)="onLogout()">Logout</button>
–home.component.ts
import { AuthService } from "../auth.service";
onLogin(){
this.authService.login();
}
onLogout(){
this.authService.logout();
}
Now you can navigate child route of server page when you clicked login button.