I use angularjs in my application, where I created a directive for bxslider. The directive code is as follows:
angular.module('sbAdminApp')
.directive('bxSlider', function(){
return{
restrict: "A",
require: "ngModel",
link: function(scope, element, attrs, ctrl){
element.ready(function(){
$($(element[0])).bxSlider({
maxSlides:1,
auto:true,
controls:false,
pager:true
});
})
}
}
})
Above, I use like this $($(element[0])).bxSlider({after the ready function, since I am looking for a problem in which bxslider should work with ng-repeat , and found this solution after which bxslider works, but sometimes images do not work, t, and I always see this error.
Uncaught TypeError: Cannot read the 'indexOf' property from undefined
source
share