Jssor滑块不适用于AngularJS

时间:2015-04-14 06:57:43

标签: javascript jquery angularjs slider jssor

我有一个Jssor滑块,可以正常使用jQuery版本。但是当我将代码和JS文件放入我的AngularJS应用程序时,它无法正常工作。我在控制台中收到以下错误:

  

未捕获的TypeError:无法读取属性' currentStyle'未定义的

AngularJS中是否有使用Jssor滑块的特定方法?



var app = angular.module('slider', []);

app.controller('sliderCtrl', function($scope){
  this.slides = [
    {heading: 'movies', number: 115, panel: 'panel-green'},
    {heading: 'viewed', number: 252 , panel: 'panel-primary'},
    {heading: 'streams', number: 354 , panel: 'panel-yellow'},
    {heading: 'length', number: 471 , panel: 'panel-green'},
    {heading: 'Spent', number: 589, panel: 'panel-red'},
    {heading: 'viewed two', number: 789 ,panel: 'panel-yellow'},
    {heading: 'streams two', number: 412 , panel: 'panel-green'},
    {heading: 'length two', number: 456, panel: 'panel-red'}    
  ];
  $scope.data = this;
});

<div id="wrapper">
    <div class="row" id="page-wrapper" ng-controller="sliderCtrl">
        <div id="slider1_container">
            <div u="slides" class="slides" class="col-lg-2 col-custom-lg-2 col-md-4">
                <div ng-repeat="div in data.slides" class="panel {{div.panel}}">
                    <div class="panel-heading">
                        <div class="row">
                            <div class="col-xs-3">                               
                            </div>
                            <div class="col-xs-12 text-right">
                                <div class="huge">{{div.number}}</div>
                                <div >{{div.heading}}</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div> 
            <span u="arrowleft" class="jssora03l arrowleft"></span>            
            <span u="arrowright" class="jssora03r arrowright"></span>        
        </div>
    </div>
&#13;
&#13;
&#13;

我刚刚尝试了上面的代码,它正在我的主HTML布局中工作。但是,当我把它放入我的模板时,它不起作用,我遇到了同样的错误。

1 个答案:

答案 0 :(得分:1)

尝试使用ng-class。或者有问题 用jssor初始化。为jssor滑块创建指令更好。 Here已经是jssor滑块的AngularJS指令。使用它!