单击后折叠导航栏菜单

时间:2017-08-01 12:18:18

标签: javascript angular angular2-routing

<nav class="navbar navbar-toggleable-md fixed-top top-header">
      <div class="container">
        <a href="" data-target="#sidebar" data-toggle="collapse" class="hidden-md-up">
          <img alt="" src="/images/portal/bar-icon.png">  
        </a>
        <a class="navbar-brand" [routerLink]="['/']" *ngIf="portalInfo">
          <!--[routerLink]="['/']"-->
        <img  *ngIf="portalInfo.logo_url" src="{{portalInfo.logo_url}}" width="120" height="30" />
        <span *ngIf="!portalInfo.logo_url" >{{portalInfo.portal_name}}</span>
        </a>
        <a class=" phone-m hidden-md-up hidden-lg-up" (click)="open(content)">
          <img src="/images/portal/phone-m.png" class="pull-right" alt="call-for-loan" />
        </a>
        <div class="collapse navbar-collapse top-header-nav pull-right" id="navbarsExampleDefault" >
          <div class="col-md-12 pull-right">

            <div class="header-contact">
              <ul class="list-unstyed"  *ngIf="portalInfo">
                  <li>
                      <a href="tel:{{portalInfo.loan_number}}" class="hidden-xs-down default-cursor">
                          <!--<img src="/assets/images/phone_headder.png" alt="logo" />-->
                          <span class="headermob-icon"></span>
                          <span>For Loan: {{portalInfo.loan_number}}</span>
                      </a>
                  </li>
                  <li>
                      <a href="tel:{{portalInfo.contact_number}}" class="hidden-xs-down default-cursor">
                          <!--<img src="/assets/images/phone.png" alt="logo" />-->
                          <span class="headermob-icon"></span>
                          <span>Call: {{portalInfo.contact_number}}</span>
                      </a>
                  </li>
              </ul>
            </div>

            <ul class="navbar-nav pull-right" >
              <ng-container *ngFor="let m of menu;">
                  <li class="nav-item menu" *ngIf="m.top && m.link_type=='INTERNAL'">
                      <a  class="nav-link" [routerLink]="[m.link]" href="{{m.link}}">{{m.name}}></a>
                  </li>
                  <li class="nav-item" *ngIf="m.top && m.link_type!='INTERNAL'">
                      <a  class="nav-link" target="_blank" href="{{m.link}}">{{m.name}}</a>
                  </li>
              </ng-container>
            </ul>

          </div>
        </div>
      </div>
  </nav>

这是我的导航栏。单击导航栏项后没有隐藏它的角度2。这个代码应该用来隐藏菜单项后点击其中任何一个。请找到并让我知道结果。提前谢谢。

0 个答案:

没有答案