我正在试图找出如何将一个幻灯片号码传递到ui.bootstrap旋转木马。在下面的柱塞,我有两个按钮-一个简单地打开一个模态,其中包含一个幻灯片旋转木马。另一种方法也这样做(打开幻灯片3),但传递幻灯片号以在模态旋转木马中显示。
当点击“Opento幻灯片3”时,我很难弄清楚如何使用旋转木马中打开的函数中的幻灯片号来显示选定的幻灯片号。
我怎样才能做到这一点?
我的代码:
<!doctype html>
<html ng-app="plunker">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<script src="example.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div ng-controller="ItemsCtrl">
<div ng-controller="ModalDemoCtrl">
<button class="btn btn-default" ng-click="open()">Open me!</button>
<button class="btn btn-default" ng-click="open(2)">Open to slide 3!</button>
</div>
</div>
</body>
</html>发布于 2014-03-18 15:49:52
在您的ModalInstanceCtrl函数中,将以下内容添加到代码中:
var ModalInstanceCtrl = function ($scope, $modalInstance, items, modalName, slideTo) {
$scope.items = items;
$scope.modalName = modalName;
$scope.slideTo = slideTo;
// this is what tell the carousel wich item should be active.
if(slideTo){
items[slideTo].active=true;
}
...https://stackoverflow.com/questions/22481698
复制相似问题