2017-02-20 76 views
0
.sub-navbar { 
    background-color: #002b31; 
    height:57px; 
    font-size: 13px; 
    margin-top: 175px; 
} 

這是我的CSS文件時,角2 - ngFor subnavbar菜單不使用CSS

這是我的HTML文件

<div class="container-fluid"> 
<div class="row"> 
    <nav class="navbar navbar-default sub-navbar"> 
     <div *ngFor="let nav of navMenu"> 
      <ul class="nav navbar-nav "> 
       <div *ngIf="nav.link == currentLink"> 
        <li *ngFor="let sub of nav.subMenu"> 
         <a [routerLink]="[sub.link]"> 
          {{sub.name}} 
         </a> 
        </li> 
       </div> 
      </ul> 
     </div> 
    </nav> 
</div> 

這裏是什麼看起來像子菜單,因爲菜單是好的/照片

Image

回答

0

我找到了解決辦法:d - 週末

<div class="container-fluid "> 
<div class="row"> 

    <nav class="navbar navbar-default sub-navbar"> 
     <div *ngFor="let nav of navMenu"> 
      <ul class="nav navbar-nav " *ngIf="nav.link == currentLink"> 
       <!--<div *ngIf="nav.link == currentLink" >--> 
        <li *ngFor="let sub of nav.subMenu"> 
         <a [routerLink]="[sub.link]"> 
          {{sub.name}} 
         </a> 
        </li> 
       <!--</div>--> 
      </ul> 
     </div> 
    </nav> 
</div> 

的問題是與ngIf

標籤