扫码关注官方订阅号
用angularjs写了个项目用到了幻灯片我用swiper.js插件,现在遇到的问题是前台数据调用前执行了swiper.js代码,所以前台幻灯片错位了,swiper.js没拿到准确的循环个数,没有计算到。
有什么方法监听到前台数据循环完了再调用swiper.js代码呢?或者有其他什么方法可以解决这个问题呢?
认证0级讲师
我也遇到了同样的代码 下面是我的解决方法
.directive('repeatDone',function(){ return{
link:function(scope,element,attr){ if(scope.$last){ scope.$eval(attr.repeatDone); } }
}}).controller('',function(){
$scope.isRepeat=function(){ swiper代码; }
})<ul><li repeat-done="isRepeat()"></li></ul>
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
我也遇到了同样的代码 下面是我的解决方法
.directive('repeatDone',function(){
return{
}
})
.controller('',function(){
})
<ul><li repeat-done="isRepeat()"></li></ul>