我决定将ngInfinitiScroll插件添加到我的应用程序中。因此我调用了文件:
<script type="text/javascript" src="{!! asset('/js/ng-infinite-scroll.min.js') !!}"></script>
在我的events.js文件中,我发起了这样的模块:
(function(window) {
// Define the `app` module
var app = angular.module('stayhyper', ['infinite-scroll']);
app.controller('eventController', ['$scope', '$rootScope', '$http', 'myService',
function($scope, $rootScope, $http, myService) {
} // end of main function
]); // end of controller
})(window);
然后我收到以下错误:
错误:$ injector:unpr未知提供商
未知提供者:myServiceProvider&lt; - myService&lt; - eventController
MyService(这是在标题中加载的单独的js文件中):
app.service('myService', function() {
this.URL= function() {
// set the main route of the site
var subhost = "/"
if (window.location.host == "localhost") {
subhost = "/myapp/public/"
}
window.urlRoot = window.location.origin + subhost;//main root of the site
return window.urlRoot;
}
this.APIURL= function() {
// set the main route of the site
var subhost = "/api/"
if (window.location.host == "localhost") {
subhost = "/myapp/public/api/"
}
window.urlRoot = window.location.origin + subhost;//main root of the site
return window.urlRoot;
}
});
答案 0 :(得分:1)
您需要先加载books = Book.objects.filter(sequence__gte=bookD.sequence).exclude(pk=bookD.pk)
books.update(sequence=F('sequence')+1)
,然后加载event.js
,然后最初只创建模块,同时确保已在html中添加mainapp.js
所以订单将是,
infinite-scroll
还要确保您没有再次调用该模块。