angularjs and bootstrap javascript

前端 未结 4 732
闹比i
闹比i 2020-12-20 00:27

I have a twitter bootstrap carousel in an angular app. If I use the data-slide attribute thus:



        
4条回答
  •  青春惊慌失措
    2020-12-20 01:17

    Seeing as you put me on the right course to fix my issue I had, below is my directive and the html

    angular.module('portal.directives', [])
        .directive('bootCarousel', function(){
            return function(scope, elem, attrs) {
                scope.carouselPrev = function(){
                    $('#'+attrs.id).carousel('prev');
                }
    
                scope.carouselNext = function(){
                    $('#'+attrs.id).carousel('next');   
                }
            }
        });
    

    Html:

提交回复
热议问题