Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49184

Two ion-slides with two controllers and views

$
0
0

@Smirnova wrote:

Hi there,

I need to implement two sliders into two different views. So I'm using two different controllers for that:

.controller('SettingsCtrl', function($scope, $state) {
//options for the slider
$scope.options = {
loop: true,
pagination: false,
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev'
};

$scope.data = {
    slides : [
        {
            drink_family_name:    'beer',
            drink_family_img:     'img/ionic.png'
        },
        {
            drink_family_name:    'wine',
            drink_family_img:     'img/ionic.png'
        },
        {
            drink_family_name:    'spirit',
            drink_family_img:     'img/ionic.png'
        },
        {
            drink_family_name:    'cocktail',
            drink_family_img:     'img/ionic.png'
        }
    ]
};

})
.controller('MainCtrl', function($scope, $state, $ionicSlideBoxDelegate) {

$ionicSlideBoxDelegate.update();

//options for the slider
$scope.options = {
    loop: true,
    pagination: false,
    nextButton: '.swiper-button-next',
    prevButton: '.swiper-button-prev'
};

$scope.data = {
    drinks : [
        {
            family:     'beer',
            name:       'beer glass 200ml',
            img:        'img/ionic.png',
            contains:   '0.6'
        },
        {
            family:     'beer',
            name:       'beer glass 500ml',
            img:        'img/ionic.png',
            contains:   '1.6',
        },
        {
            family:     'wine',
            name:       'wine glass 100ml',
            img:        'img/ionic.png',
            contains:   '1'
        },
        {
            family:     'wine',
            name:       'wine bottle 750ml',
            img:        'img/ionic.png',
            contains:   '8',
        }
    ]
};

})

The result: first slider works fine, the second one shows the first slide for half a second and then - nothing.

What am I doing wrong here? )

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>