Git Product home page Git Product logo

Comments (9)

vasyabigi avatar vasyabigi commented on August 17, 2024

Actually you can find an example in app/views/main.html.

<slick class="slider single-item" current-index="index" responsive="breakpoints" slides-to-show=3 slides-to-scroll=3>
  <div ng-repeat="i in [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]"><h3>{{ i }}</h3></div>
  <p>Current index: {{ index }}</p>
</slick>
<p ng-click="index=4">Change index to 4</p>

current-index property works well for this purpose.

from angular-slick.

iamstarkov avatar iamstarkov commented on August 17, 2024

In my case it doesn't work

Controller looks like:

$scope.buttons = [
  { class: 'round_vet', text: 'vet' },
  { class: 'round_water', text: 'water' },
  { class: 'round_comm', text: 'comm' },
  { class: 'round_protect', text: 'protect' },
  { class: 'round_health', text: 'health' },
  { class: 'round_cult', text: 'cult' },
  { class: 'round_forest', text: 'forest' },
  { class: 'round_country', text: 'countryо' }
];

Jade template look like this:

.scroller(ng-controller='ScrollerButtonsCtrl')
  slick(slides-to-show="{{buttons.length}}" current-index="index" slides-to-scroll="1")
    .scroller-item(ng-repeat='button in buttons')
      a.round(class='{{button.class}}' href=jv0)
      a.scroller-text(href=jv0) {{button.text}}
  .scroller-button.scroller-button_right(ng-click="index = index + 1")

from angular-slick.

younesouhbi avatar younesouhbi commented on August 17, 2024

The example given by vasyabigi above didn't work for me. I had to change the line 140 in the directive from:
return slider.slickGoTo(newVal);
to:
return slider.slick("slickGoTo", newVal);

from angular-slick.

capsule5 avatar capsule5 commented on August 17, 2024

Hello. Nice directive but same problem. I need to change current slide from the controller. vasyabigi's solution doesn't work if current-index is a scope variable defined with a stateParam for example. slickGoTo is necessary!

from angular-slick.

smongey avatar smongey commented on August 17, 2024

I’m generating thumbnails using a separate ng-repeat outside of the slick element. This is so I can click a thumbnail and slick will go to the relevant slide. I’m using this

index=$index

within a separate ng-repeat for the thumbnails. It appears to generate the right code but will only work if this is static and not within the repeat. Any idea how this might be resolved or why this isnt working?

from angular-slick.

veruscae avatar veruscae commented on August 17, 2024

Hallo! Great directive but I need to change current slide and have the same problem. the Example in app/views/main.html doesn't work for me :(
I have multiple-items and dynamic load.
Any help will be welcome.

from angular-slick.

capsule5 avatar capsule5 commented on August 17, 2024

`

`

and

$scope.slick = { current:0, init : function(){}, goto : function(index){this.current = index}, next : function(index){this.current++}, prev : function(index){this.current--}, onBeforeChange : function(){}, onAfterChange : function(){} }

does the trick for me. Hope it helps.

from angular-slick.

veruscae avatar veruscae commented on August 17, 2024

@capsule5 Thanks! That was really helpful!
Finally it works :-)

from angular-slick.

Lospepes avatar Lospepes commented on August 17, 2024

Hello for me, I did exactly the opposit of @younesouhbi
from:
return slider.slick("slickGoTo", newVal);
to:
return slider.slickGoTo(newVal);

Someone can explain to me why I needed to do that please ?

from angular-slick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.