Skip to content

Sidebar and navbar are not rendering if the page is not refreshed angular2 #437

@chandra329706

Description

@chandra329706

In the below code, sidebar and navbar are not being rendered if the page is not refreshed.

Component:

import { Component, OnInit } from '@angular/core';
import {Router} from "@angular/router";

@component({
selector: 'app-layout',
templateUrl: './layout.component.html',
styleUrls: ['./layout.component.css']
})
export class LayoutComponent implements OnInit {
constructor(private _router : Router) { }
IsLoggedIn : boolean = false;
ngOnInit() {
if(localStorage.getItem('currentUserId')) this.IsLoggedIn = true;
}
}

HTML

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions