Angularjs Scroll To Counter In Ng-repeat June 23, 2022 Post a Comment Need to scroll to specific element in a list if $index == $scope.counter of ng-repeat. HTML: FIND TYPE A Solution 1: You've to write a directive for that and watch for counter to update. As soon as it updates, your directive finds the element by index (counter) and scrollTo it. Here is a demo: http://jsfiddle.net/ZdunA/1/ myApp.directive('scrollTo', function() { return { restrict: 'A', link: function(scope, element, attrs) { var $body = $('body'); scope.$watch('counter', function(newVal, oldVal) { if (newVal && newVal !== oldVal) { $body.scrollTop(element.find('li').eq(newVal).position().top) } }); } }; }); Copy Baca JugaAjax Submit NiceditCss & Js Files Not Rendered When Deploy Of Asp.net Mvc Application On Iis 8 (windows 8)Catch Javascript Customevent By Jquery On() Preserving Custom Properties At First "level" Share You may like these postsDynamically Generating Validation Attribute On Input Using InterpolationNot Getting Response When Register Is SuccessfulFiltering Data With Angularjs Filter. How To Iterate Over Objects?Angularjs Filter With "or" Condition? Post a Comment for "Angularjs Scroll To Counter In Ng-repeat"
Post a Comment for "Angularjs Scroll To Counter In Ng-repeat"