最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Angularjs中使用輪播圖指令swiper

 更新時(shí)間:2017年05月30日 09:15:00   作者:科比net  
這篇文章主要介紹了Angularjs中使用輪播圖指令swiper的相關(guān)知識(shí),非常不錯(cuò),具有參考借鑒價(jià)值 ,需要的朋友可以參考下

我們?cè)赼ngualrjs移動(dòng)開(kāi)發(fā)中遇到輪播圖的功能

安裝 swiper  npm install --save swiper   或者 bower install --save swiper

引入文件路徑

<link rel="stylesheet" href="../bower_components/swiper/dist/css/swiper.min.css" rel="external nofollow" />
<script src="../bower_components/swiper/dist/js/swiper.jquery.min.js"></script>

指令中的編寫(xiě)方式

(function() {
 'use strict';
 angular
  .module('campus.core') //對(duì)應(yīng)項(xiàng)目的module 請(qǐng)換成自己的模塊名稱(chēng)
  .directive('swipers',swipers);
  swipers.$inject = ['$timeout'];
  function swipers($timeout) {
   return {
    restrict: "EA",
    scope: {
     data:"="
    },
    template: '<div class="swiper-container silder">'+
        '<ul class="swiper-wrapper">'+
        '<li class="swiper-slide" ng-repeat="item in data">'+
        '<a class="img40" href="{{item.contentUrl}}" rel="external nofollow" ><img ng-src="{{item.imgId}}" alt="" /></a>'+
        '</li>'+
        '</ul>'+
        '<div class="swiper-pagination"></div>'+
        '</div>',
    link: function(scope, element, attrs) {
       $timeout(function(){
         var swiper = new Swiper('.swiper-container', { //輪播圖綁定樣式名
          pagination: '.swiper-pagination',  
          paginationClickable: true,    
          autoplay: 2500,
        }); 
       },100); 
    }
   };
  }
})();

data 綁定接口返回的輪播列表 vm.home.headImgs對(duì)應(yīng)輪播圖返回的數(shù)據(jù)列表

 <!--輪播圖-->
 <swipers data="vm.home.headImgs" ></swipers>

以上所述是小編給大家介紹的Angularjs中使用輪播圖指令swiper ,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)歡迎給我留言,小編會(huì)及時(shí)回復(fù)大家的!

相關(guān)文章

最新評(píng)論

马龙县| 固阳县| 杭锦后旗| 海门市| 正镶白旗| 乐清市| 东港市| 常州市| 星座| 岢岚县| 汉阴县| 西和县| 井研县| 吴川市| 勃利县| 乌恰县| 东明县| 浮梁县| 吴桥县| 凤翔县| 安远县| 贞丰县| 濮阳县| 柞水县| 周宁县| 宣恩县| 内江市| 合作市| 上栗县| 新野县| 台江县| 西安市| 涡阳县| 清河县| 石家庄市| 阳西县| 曲麻莱县| 宜宾县| 共和县| 洪洞县| 丽水市|