我正试图从active slide object
获取slides array
角色UI引导轮播:
我目前的解决方案:
app.controller('myContr', ['$scope', '$http', 'filterFilter', function($scope, $http, filterFilter) {
$scope.b = {};
$scope.b.int = 5000;
$scope.b.active = 0;
var banners = [
{
"delay": 5,
"position": "top",
"background": "img_url",
},
{
"delay": 5,
"position": "top",
"background": "img_url",
}
];
var b = $scope.b.banners = filterFilter(banners, {
position: 'top'
});
$scope.$watch('b.active', function(active) {
$scope.b.int = parseInt(b[active]['delay'])*1000;
});
}]);
HTML:
<body ng-controller="myContr">
<div uib-carousel interval="b.int" active="b.active">
<div uib-slide ng-repeat="ban in b.banners track by $index" index="$index">
<img ng-src="{{ban.background}}" class="img-responsive center-block">
</div>
</div>
</body>
bootstrap UI允许设置幻灯片的active index
,因此我使用$watch
来确定活动幻灯片,但我在源代码中看到已经有$watch
我的问题是还有其他方法可以在不使用$watch
的情况下获取活动幻灯片对象吗?
actual
上有一个uib-slide
参数,但找不到任何关于它的内容的文档。