如何在 ng-repeat 中使用 anchorScroll() 在索引 x 处开始查看
How to use anchorScroll() with in ng-repeat to have start view at index x
我正在尝试以 15 分钟为步长列出 24 小时内的所有分钟数。
所以,我在数组中列出了这些分钟列表,并使用 ng-repeat
.
循环它们
就我而言,当页面加载时,我想将 07:30 中的列表显示为顶部,但如果我向上滚动,它必须能够显示 07:15、07:00...
我尝试使用 filter: 'after'
,它显示从 07:30 但不是在 07:15、07:00...
之前
有没有办法让 ng-repeat
从元素 07:30 开始显示?
I have created a plunker with what I have tried.
请提供任何帮助,在此先感谢。
这是工作plunker
$scope.goto = function (){
$timeout(function() {
$location.hash(30);
$anchorScroll();
});
}
使用 $timeout :-)
我正在尝试以 15 分钟为步长列出 24 小时内的所有分钟数。
所以,我在数组中列出了这些分钟列表,并使用 ng-repeat
.
循环它们
就我而言,当页面加载时,我想将 07:30 中的列表显示为顶部,但如果我向上滚动,它必须能够显示 07:15、07:00...
我尝试使用 filter: 'after'
,它显示从 07:30 但不是在 07:15、07:00...
有没有办法让 ng-repeat
从元素 07:30 开始显示?
I have created a plunker with what I have tried.
请提供任何帮助,在此先感谢。
这是工作plunker
$scope.goto = function (){
$timeout(function() {
$location.hash(30);
$anchorScroll();
});
}
使用 $timeout :-)