$ anchorScroll for class

In my web application, I allow the user to use the arrow keys to scroll up and down the large list using ng-repeat:

<li ng-repeat="vpn in vpns 
          | orderBy: 'Title' 
          | customFilter:searchString" 
          ng-class="{'highlight': $index == focusIndex }"> 

the current one <li>gets class allocation. I would also like to scroll the page to their current selection, since each is <li>large, and the page can only display 3 at a time. I know that I can use $locationit $anchorScrollto scroll to id using the documentation , but I cannot figure out how to scroll a class or use some kind of ng-idanalogue to an ng class (only one element will be highlighted at a time).

If anyone could offer me some pointers, that would be great. Thank!

+4
source share

Source: https://habr.com/ru/post/1545386/


All Articles