我有下面的代码使用角-光滑。fevt不停地在第一个光滑的旋转木马上滑动。
<slick slides-to-scroll="1" arrows="false" current-index="slick.current" class="first-slide" on-after-change="slick.onAfterChange(this)">
<div ng-repeat="s in evt">
</div>
</slick>
<slick slides-to-scroll="{{numtoslide}}" init-onload=true data="fevt" arrows="false" variable-width="true" center-padding="60px" center-mode="false">
<div ng-repeat="t in fevt" ng-if="t.section != 'venues'" style="width:320px;margin-right:5px;" >
</div>
</slick>about.js
$scope.slick = { current:0, init : function(){}, goto : function(index) {this.current = index}, next : function(index){return this.current++}, prev : function(index){this.current--}, onBeforeChange : function(){}, onAfterChange : function(){} }
$scope.slick.onAfterChange = function(e){
$scope.fevt = [];
for(var j=0; j< $localStorage.eventlist[0].items.length; j++){
if($localStorage.eventlist[0].items[j].related_venue == $scope.test){
$scope.fevt.push($localStorage.eventlist[0].items[j]);
}
}
$scope.$apply();
}slick.js
if (scope.initOnload) {
isInitialized = false;
return scope.$watch('data', function (newVal, oldVal) {
if (newVal != null) {
return $transclude(function (clone, scope) {
var compiled;
if (isInitialized) {
destroySlick();
}
compiled = $compile(clone)(scope);
element.append(compiled);
initializeSlick();
return isInitialized = true;
});
}else{
isInitialized = false;
initializeSlick();
}
});
} else {
return $transclude(function (clone, scope) {
var compiled;
compiled = $compile(clone)(scope);
element.append(compiled);
return initializeSlick();
});
}当滑过后变事件时,会检测到新的值,但是安全旋转木马不会基于新数组进行更新。
任何帮助都非常感谢
发布于 2015-07-06 23:22:40
我找不到解决办法,所以我改变了方法,让它发挥作用。
我结合了灵活的和灵活的人来实现我想要的东西。
Slick首先加载滑块和afterChange函数触发事件,并创建用于ng重复的新数组,而每次在第一个滑块中滑动时,will都会生成新的silder。
谢谢
https://stackoverflow.com/questions/31108573
复制相似问题