Maha Waqar
Maha Waqar

Reputation: 643

Side Nav component gets repeat with each dashboard in aurelia

Hae !! I am new to Aurelia and components. I am creating two different dashboards and each dashboard has its own side-nav and main-menu as components. The way I am including them:

<template>
  <require from="pages/components/admin/nav-bar"></require>
  <require from="pages/components/admin/main-menu"></require>
  <nav-bar></nav-bar>  
  <main-menu></main-menu>
  <div class="w-100">
    <router-view ></router-view>
  </div>
</template>

I have a button to switch between two dashboards. Issue I am encountering is: When I open admin dashboard, it successfully displays its main-menu and side-nav. When I switch to employee dashboard, nav-bar of employee replaces but main-menu of employee comes under the main-menu of admin. When I switch to admin back, same thing happens again... and in the end I gets stack of nav-bars on top of each other.

Main-Menu structure:

<template>
        <div class="main_menu">
                <nav class="navbar navbar-expand-lg">
                    <div class="container">
                        <div class="navbar-collapse align-items-center collapse" id="navbar">                
                            <ul class="navbar-nav"> 
                            </ul>
                        </div>        
                    </div>
                </nav>
        </div>
</template>

Nav-Bar structure:

<template>
        <nav class="navbar navbar-fixed-top">
                <div class="container">
                    <div class="navbar-brand">
                        <a href=""><img src=/src/assets/logo.png" alt="Talos" class="img-responsive logo"></a>
                    </div>

                    <div class="navbar-right">
                        <form id="navbar-search" class="navbar-form search-form">
                            <input value="" class="form-control" placeholder="Search here..." type="text">
                            <button type="button" class="btn btn-default"><i class="icon-magnifier"></i></button>
                        </form>               

                        <div id="navbar-menu">
                            <ul class="nav navbar-nav">    
                            </ul>
                        </div>
                  </div>
             </div>
       </nav>
</template>

Could anyone suggest that where am I wrong?

Upvotes: 1

Views: 44

Answers (0)

Related Questions