Skip to content
This repository has been archived by the owner on May 10, 2018. It is now read-only.

Force initial carouselIndex #312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thenikso
Copy link

This issue is described in #296

The solution is a bit convoluted but the point is that the provided initial index was overridden because slides were not loaded yet.

@EAndreyF
Copy link

Please, merge this fix quickly. It's really need for me.

@revolunet
Copy link
Owner

@EAndreyF : did you try this PR ?

@EAndreyF
Copy link

No. Changes for me is in 488: currentSlides && currentSlides.length > 0 && newValue >= currentSlides.length or just currentSlides && currentSlides.length && newValue >= currentSlides.length

Because I initialize my slider without images. If this PR is hard to test, I could make simple PR for my changes.

@bloodlanser
Copy link

+1

@treyhoover
Copy link

+1 this solved my problem

@demyz
Copy link

demyz commented Jun 18, 2015

+1

1 similar comment
@jonyw4
Copy link

jonyw4 commented Nov 11, 2015

+1

@a627382
Copy link

a627382 commented Jun 13, 2017

@thenikso
This fix doesn't work.

<ul class="elements vehicleImg" rn-carousel-index="$ctrl.vehicleIndex" rn-carousel-controls rn-carousel rn-carousel-pause-on-hover>
    <li ng-repeat="vehicle in $ctrl.vehicles">
      <img ng-src="{{ $ctrl.getImage(vehicle) }}" onerror="this.src='img/photos/vehicule.gif'"/>
            {{$index}} should be {{$ctrl.vehicleIndex}}
    </li>
  </ul>

I define in the controller this.vehicleIndex = 2 but the $index keeps being initially set to 0:
index_not_forced

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants