2016-01-14 50 views
0

我使用的是引導和AngularJS工具欄菜單和我有這個代碼,以使側邊欄菜單,名單與AngularJS

<ul class="nav navbar-nav"> 

      <li><a href="#"><span class="glyphicon glyphicon-send"></span> Link</a></li> 
      <li class="active"><a href="#"><span class="glyphicon glyphicon-plane"></span> Active Link</a></li> 
      <li><a href="#"><span class="glyphicon glyphicon-cloud"></span> Link</a></li> 

      <!-- Dropdown--> 
      <li class="panel panel-default" id="dropdown"> 
       <a data-toggle="collapse" href="#dropdown-lvl1"> 
        <span class="glyphicon glyphicon-user"></span> Sub Level <span class="caret"></span> 
       </a> 

       <!-- Dropdown level 1 --> 
       <div id="dropdown-lvl1" class="panel-collapse collapse"> 
        <div class="panel-body"> 
         <ul class="nav navbar-nav"> 
          <li><a href="#">Link</a></li> 
          <li><a href="#">Link</a></li> 
          <li><a href="#">Link</a></li> 

          <!-- Dropdown level 2 --> 
          <li class="panel panel-default" id="dropdown"> 
           <a data-toggle="collapse" href="#dropdown-lvl2"> 
            <span class="glyphicon glyphicon-off"></span> Sub Level <span class="caret"></span> 
           </a> 
           <div id="dropdown-lvl2" class="panel-collapse collapse"> 
            <div class="panel-body"> 
             <ul class="nav navbar-nav"> 
              <li><a href="#">Link</a></li> 
              <li><a href="#">Link</a></li> 
              <li><a href="#">Link</a></li> 
             </ul> 
            </div> 
           </div> 
          </li> 
         </ul> 
        </div> 
       </div> 
      </li> 

      <li><a href="#"><span class="glyphicon glyphicon-signal"></span> Link</a></li> 

     </ul> 

我的問題是,當我的子級菜單上單擊它重定向我到本地主機/#dropdown-lvl1而不是顯示div dropdown-lvl1,任何想法爲什麼它有這種行爲?

回答

0

角使用#中的URL來路由,因爲你有<a data-toggle="collapse" href="#dropdown-lvl2">它會嘗試去這條路線,以便在頁面使用滾動$anchorScroll