簡體   English   中英

使用ui-sref參數時,UI-router ui-sref-active引發錯誤

[英]UI-Router ui-sref-active throws error when using ui-sref params

我有一個Bootstrap導航欄下拉菜單,單擊父鏈接會生成下拉列表(默認行為)。 父級的下拉列表是使用ngRepeat從導航數據數組中構建的,每個列表都有一個ui-router狀態參數,因此如下所示:

 <li class="dropdown">
    <a href class="dropdown-toggle" data-toggle="dropdown">
        Parent Link
    </a>
    <ul class="dropdown-menu" role="menu">

        <li ng-repeat="item in navCtrl.items()" 
            ui-sref-active="active">
            <a ui-sref="some.state({ paramKey: paramValue })">
                {{item.link}}
            </a>
        </li>

    </ul>
</li>

但是,即使似乎確實在我的鏈接上刪除了活動類,它也會在控制台中引發以下錯誤:

TypeError:無法讀取未定義的屬性“名稱”

我對答案並不完全確定,但是據我所知,為什么還要在括號中使用navCtrl.items() 我從未見過像以前那樣使用過。 ng-repeat item in items的舊item in items不起作用嗎? 抱歉,如果完全沒有幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM