I am using angular js and data-ng-repeat to get data. Below is my HTML.
<div id="newsslide" class="owl-carousel owl-theme">
<div class="item darkCyan" data-ng-repeat="items in NewsList">
Hello
</div>
</div>
Here is my 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))
});
}
Data is binding Fine. But it shows
TypeError: $(...).owlCarousel is not a function.
I also tried to run $("#newsslide").owlCarousel({});
through pasting in chrome developer console. I got error
Uncaught TypeError: $(...).owlCarousel is not a function at Anonymous:1:18.
Below is library sequence i added, [jQuery library was in head tag before this image. and thats why it cause problem] []1
I have searched a lot. Please help. Thanks
These can be the potential reason.
You need to add jquery before angularjs.
<script src="jquery.min.js"></script>
<script src="angular.min.js"></script>