swiper on ionics / angularjs

Posted: September 28, 2015 in web

index.html

<link rel="stylesheet" href="lib/swiper/swiper.min.css">
<script src="lib/swiper/swiper.min.js"></script>

template – swiper.html

    <style>
    .swiper-container {
        width: 500px;
        height: 300px;
        margin: 20px auto;
    }

    </style>
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
            <div class="swiper-slide">Slide 4</div>
            <div class="swiper-slide">Slide 5</div>
            <div class="swiper-slide">Slide 6</div>
            <div class="swiper-slide">Slide 7</div>
            <div class="swiper-slide">Slide 8</div>
            <div class="swiper-slide">Slide 9</div>
            <div class="swiper-slide">Slide 10</div>
        </div>
    </div>

directive

        .directive("swiperSlider", function () {
            return {
                restrict: 'E',
                scope: {},
                templateUrl: 'template/swiper.html',
                link: function (scope, el, attr) {
                    var swiper = new Swiper('.swiper-container');
                    console.log('bbbb');
                }
            }
        })
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s