1
我正在使用angular js和data-ng-repeat来获取数据。 以下是我的HTML。
<div id="newsslide" class="owl-carousel owl-theme">
<div class="item darkCyan" data-ng-repeat="items in NewsList">
Hello
</div>
</div>
这里是我的JS
$scope.getNewsList = function (Id) {
var getData = HomeService.getNewsList(Id);
getData.then(function (_result) {
$scope.getMediaList(Id);
if (_result.data.length > 0) {
$scope.NewsList = _result.data;
$scope.NewsNoRecords = false;
$timeout(function() {
$("#newsslide").owlCarousel({
items: 3,
nav: false,
dots: true,
rtl:true,
// autoPlay: 3000,
navText: [
"<i class='fa fa-angle-left'></i>",
"<i class='fa fa-angle-right'></i>"
]
});
}, 1000);
}
else {
$scope.NewsNoRecords = true;
}
}, function (errorMsg) {
$scope.loadingDataEntryList = false;
console.log('Error in getting records - ' + JSON.stringify(errorMsg))
});
}
数据结合精细。但它显示
TypeError: $(...).owlCarousel is not a function.
我也尝试通过粘贴在Chrome开发者控制台中运行$("#newsslide").owlCarousel({});
。我得到错误
Uncaught TypeError: $(...).owlCarousel is not a function at Anonymous:1:18.
下面是我添加的库序列,[jQuery库在此图像之前的头标记中。这就是为什么它造成问题] [] 1
我已经搜索了很多。请帮忙。谢谢
检查您是否在应用程序初始化模块中添加了参考库,并且它也出现在页面中(通过查看页面源) –
显示加载到您的主HTML文件中的'
使用所有库附近和以上的jquery解决了这个问题。在此之前,jquery已成为头条。谢谢...
来源
2017-07-04 09:34:22 sid1001