Angular 2 - ng For subnavbar菜单不适用于CSS

时间:2017-02-20 13:44:12

标签: css angular

.sub-navbar {
  background-color: #002b31;
  height:57px;
  font-size: 13px;
  margin-top: 175px;
}
  

这是我的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

1 个答案:

答案 0 :(得分: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

的标签中