I have an angular2 project where index.html contains header bar. Other components will take care of logging in and displaying other stuff.
I have to show a logo in header bar which is present in index.html only if the user loggedIn. I'm setting a flag in app.component.ts if the user logged in. How to refer that flag in index.html?
<body>
<div class="content-body">
<header class="header">
<div class="header-bar container">
<div class="header-bar__main">
<div class="header-heading">
<h1 class="page-title">noHold Application</h1>
</div>
</div>
<a class="btn btn--small btn--icon ng-scope" title="Logout"><span class="icon-sign-out"></span></a> // this line should be displayed only if user logs in.
</div>
</header>
<div class="content">
<div class="content__main">
<div class="container">
<app-root>Loading... </app-root>
</div>
</div>
</div>
</div>
</body>
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
static loggedIn = false;
getLoggedIn() {
return AppComponent.loggedIn;
}
}