0
我試圖實現一個無限的滾動指令。當頁面第一次加載並滾動時,我在控制檯上看到日誌。然而,在最初的滾動之後,它不再發生。就像它只做了一次。角度指令停止射擊
我哪裏錯了?
指令:
directives.directive('ngScrolled', function() {
return function(scope, elm, attr) {
var raw = elm[0];
elm.bind('scroll', function() {
console.log('scroll direct');
if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) {
scope.$apply(attr.ngScrolled);
}
});
};
});
HTML:
<div class="col-md-7 col-lg-7" ng-style="resultsHolder" ng-include="'partials/resultCell.html'" ng-scrolled="loadMore()"></div>
有沒有可能'div'實際上只滾動一次而其他滾動事件正在更高級別的對象中發生?小提琴會幫助! –