gpt4 book ai didi

AngularJS ui-scroll 不工作(无法设置未定义的属性 'overflowY')

转载 作者:行者123 更新时间:2023-12-02 04:37:54 26 4
gpt4 key购买 nike

AngularJS 的新手。以下 ui-scroll 不起作用。感谢任何帮助。

https://plnkr.co/edit/PVCWRf1DaVtt4j7z15wx?p=preview

尝试在没有任何 jquery 库的情况下实现简单的 ui-scroll。下面是使其工作的示例代码,以便我可以扩展它以在应用程序中实现。

html

<!DOCTYPE html>
<html>
<head>
<title>Hospital</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.js"></script>
<script src="scroll.js"></script>
<script src="ui-scroll.js"></script>
<link rel="stylesheet" type="text/css" href="scroll.css">

<div ng-app="scrollerTestApp" ng-controller="ScrollerController">
<div ui-scroll="movie in movieDataSource">
<h2>{{ movie.description }}</h2>
</div>
</div>
</body>
</html>

滚动.js

var appModule = angular.module('scrollerTestApp', ['ui.scroll'])
.controller('ScrollerController', ['$scope', function($scope) {

$scope.movieDataSource = {
get: function(index, count, callback) {
var i, items = [],
item;

var min = 1;
var max = 100;

for (i = index; i < index + count; i++) {
if (i < min || i > max) {
continue;
}
item = {
description: "Item : " + i,
imageURL: "http://placehold.it/96x96&text=" + i
};
items.push(item);
}
callback(items);
}
}
}]);

最佳答案

你遇到的问题是你缺少ui-scroll-jqlite

根据文档:

File dist/ui-scroll-jqlite.js houses implementations of the above methods and also has to be loaded in your page. Please note that the methods are implemented in a separate module 'ui.scroll.jqlite' and this name should also be included in the dependency list of the main module.

就是说,我让你的plnkr编辑。

希望对您有所帮助;)。

关于AngularJS ui-scroll 不工作(无法设置未定义的属性 'overflowY'),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40426367/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com