My current app.component
looks like the following:
import { Component, Input } from '@angular/core';
import {AuthTokenService} from './auth-token.service';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
constructor(
private Auth: AuthTokenService) { };
isGuest: any = this.Auth.canActivate();
title = 'app works!';
}
I want to update the isGuest
variable from the child component login.component
.
In my app.component.html
, I have the following code:
<h1>
{{isGuest}}
</h1>
<router-outlet></router-outlet>
I attempted to modify it using @Output and Emitter
, but it didn't work due to angular router being used.