admin管理员组

文章数量:1353174

Hi I have an AngularJS accordion that I've created with the code below. I would like to add a tab index to the accordion such that someone can tab through all the li tags of the accordion.

            <accordion close-others="showOnlyOne">
                <accordion-group heading="{{group.name}}" ng-repeat="group in reportFiltered"  is-open="group.isThisOpen">
                    <ul class="nav">
                        <li ng-repeat="myObj in group.myObj">
                            <a ng-click="function(myObj.query)">{{myObj.name}}</a>
                        </li>
                    </ul>
                </accordion-group>
            </accordion>

I have tried doing things such:

tabIndex="item.index

but that doesn't seem to work.

Furthermore, I also need a way to access the tabs contents/value once they are currently tabbed on...but thats my next issue.

UPDATE:

I got the tabbing to work with {{$index}} but now I need to do something with the current li tag that is being tabbed over..

Hi I have an AngularJS accordion that I've created with the code below. I would like to add a tab index to the accordion such that someone can tab through all the li tags of the accordion.

            <accordion close-others="showOnlyOne">
                <accordion-group heading="{{group.name}}" ng-repeat="group in reportFiltered"  is-open="group.isThisOpen">
                    <ul class="nav">
                        <li ng-repeat="myObj in group.myObj">
                            <a ng-click="function(myObj.query)">{{myObj.name}}</a>
                        </li>
                    </ul>
                </accordion-group>
            </accordion>

I have tried doing things such:

tabIndex="item.index

but that doesn't seem to work.

Furthermore, I also need a way to access the tabs contents/value once they are currently tabbed on...but thats my next issue.

UPDATE:

I got the tabbing to work with {{$index}} but now I need to do something with the current li tag that is being tabbed over..

Share Improve this question edited Jun 30, 2014 at 20:09 es3735746 asked Jun 30, 2014 at 18:51 es3735746es3735746 8514 gold badges17 silver badges40 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Try

tabindex="{{item.index}}"

Or even better

ng-attr-tabindex="{{item.index}}"

You also can access $index from ngRepeat

本文标签: javascriptAdding a tab index to an AngularJS accordionStack Overflow