Comments (9)
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.
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.
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.
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.
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.
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.
`
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.
@capsule5 Thanks! That was really helpful!
Finally it works :-)
from angular-slick.
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)
- slick execution in ng-repeat HOT 2
- Unslick failure
- Can't swipe back with swipe to slide HOT 1
- Slide when number of slide is less than or equal to slides-to-show HOT 2
- Using boolean('false') always returns true HOT 1
- useCSS property does not work
- Bug doesnt display anything until autoplay begins HOT 1
- slides to scroll setting is not working in last page
- As-nav-for is not working with touch.
- Dragging makes my list disappear HOT 3
- angular slick carousel does not respect viewBox of the ng-md-icon
- ng-click on mobile dont work HOT 1
- Can't disable draggable property
- how to ban cycle?
- how to init current-index
- Cannot read property 'add' of null
- slider.unslick is not a function
- Dragend triggers click
- Passing Slick as dependency with ng-route does not load it HOT 2
- $ is not a function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-slick.