我不能让这种滑块工作,从控制器获取数据。
这个例子工作正常:
<div class="panel panel-default" ng-controller="SliderCtrl">
<div class="panel-body" ng-switch="selectedSlide">
<img src="img0.jpg" ng-switch-when="0" class="my-switch-animation" />
<img src="img1.jpg" ng-switch-when="1" class="my-switch-animation" />
<img src="img2.jpg" ng-switch-when="2" class="my-switch-animation" />
<img src="img3.jpg" ng-switch-when="3" class="my-switch-animation" />
<img src="img4.jpg" ng-switch-when="4" class="my-switch-animation" />
<img src="img5.jpg" ng-switch-when="5" class="my-switch-animation" />
</div>
</div>
但是,如果我将 img 标记更改为ng-repeat
应该导致相同代码的 a,它就不起作用。
<div class="panel panel-default" ng-controller="SliderCtrl">
<div class="panel-body" ng-switch="selectedSlide">
<img ng-repeat="slide in slides" src="{{ slide.img }}" ng-switch-when="{{ slide.id }}" class="my-switch-animation" />
</div>
</div>
我怎样才能做到这一点?