Code Monkey home page Code Monkey logo

angular-slick-carousel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-slick-carousel's Issues

Slick plugin initialization after ng-repeat end

Hello,

The directive is great but i face a problem in my implementation.

It seems that the slick plugin initialization if fired before ng-repeat has finished loading all the content (due probably to loading of images).

The result is that content blocks inside the slick directive are shown as normal blocks and then, after reloading the page, the slick carousel is visible normally because this time initialization occurs after ng-repeat has finished.

Do you have any clue about how to make slick wait until ng-repeat has finished loading everything ?

Thanx !!!

npm and package.json

Hi, coud you please add a main file direction and publish the latest version to npm which you'll need to update the package.json version number.

package.json

{
  "name": "angularSlickCarousel",
  "version": "3.0.9",
  "main": "dist/angular-ui-router.js"
}
$ npm publish

Adding a main allows users to use it as a npm module in Browserify/Webpack

var angularSlickCarousel = require('angular-slick-carousel');
// or with in ES6
import angularSlickCarousel from 'angular-slick-carousel';

Otherwise it throws this error

ERROR in ./app/scripts/app.js
Module not found: Error: Cannot resolve module 'angular-slick-carousel'

Children width: 0px in firefox

Similar to kenwheeler/slick#1325:

I'm using this library in a pretty complicated way, using ng-repeats outside and inside the directive and I've been able to get everything to work in IE and Chrome. In firefox, however, it seems like the children divs are being rendered after slick has already been initialized, giving everything a width of 0. I can't seem to figure out why.

Firefox 40.0.3 screenshot:
screen shot 2015-09-18 at 1 25 32 pm

dataCarousel.html:

<div class="ldr-carousel" ng-repeat="group in vm.centerOrder">
    <h4 class="col-xs-12">{{vm.centerMap[group]}}</h4>
    <div class="slick-loading" ng-if="!vm.loaded">
      <div class="slick-list">
        <div class="slick-track"></div>
      </div>
    </div>
    <slick class="" data="vm.carouselData[group].releasesArr"
      ng-if="vm.loaded" settings="vm.carouselData[group].slick"
      ng-class="vm.carouselData[group].slick.centerMode ? 'slick-has-center' : 'slick-no-center'">
      <div ng-repeat="release in vm.carouselData[group].slides">
        <!-- Release data -->
      </div>
    </slick>
  </div>

dataCarousel.js (only the function that is run when the directive initializes)

function initCarousel() {
  vm.loaded = false;
  vm.resultPromise
    .success(function(releaseArray) {
      angular.forEach(releaseArray, function(release) {
        // Convert strings to actual date objects
        release.releaseDates = strToDates(release.releaseDates);
        var key = release.group.name;
        if (lodash.has(vm.carouselData, release.group.name)) {
          vm.carouselData[key].releasesArr.push(release);
          vm.carouselData[key].slides.push(release);
          var rCount = vm.carouselData[key].releasesArr.length;

          var breakpoints = [{
            breakpoint: 1200,
            settings: {
              slidesToShow: 1,
              slidesToScroll: 1
            }
          }];
          var centerMode = (rCount > 5);
          var slidesToShow = centerMode ? 5 : rCount;
          vm.carouselData[key].slick.centerMode = centerMode;
          vm.carouselData[key].slick.slidesToShow = slidesToShow;
          vm.carouselData[key].slick.slidesToScroll = 1;
          vm.carouselData[key].slick.responsive = rCount > 1 ? breakpoints : [];
        } else {
          vm.carouselData[key] = {
            slick: {
              dots: false,
              arrows: true,
              responsive: [],
              centerMode: false,
              slidesToScroll: 1,
              slidesToShow: 1,
            },
            slides: [release],
            releasesArr: [release]
          };
        }
      });
      vm.loaded = true;
    });
}

So essentially, I'm building 6 slick configs and rendering 6 different carousels with those configs. I know it looks a bit confusing in this context, but "key" in the javascript file is the same as "group" in the HTML. If you need anymore code or clarification, I can try to get this to work in a plunkr.

Add a timeout of 500ms to calling slick to move it outside of $digest cycle

This directive can mostly become useful for angular users if they get to use directives such as ng-repeat to iterate on arbitrary data, for the purpose of composing the carousel.

ng-repeat however isn't guaranteed to have finished in the enclosed transcluded scope under this directive. Use $timeout to take the slickification out of the $digest cycle.

Did you remove slickHandle.slideIndex ?

Hello and thanx for the lib !

Can we still use slickHandle.slideIndex ? Because i can't make my code work for now.

My real problem is that i can use slickHandle.slickGoTo($index) inside a custom template (slickHandle belonging to another slick carousel).

The use case is two slick carousel : One for thumbs + one for large images

Cheers

customPaging is not a function

When trying to use customPaging, I'm running into this error: customPaging is not defined. I can't find any code examples for it, and just passing it in as a directive isn't working. The console shows that error and nothing is rendered to DOM.

This is my code -- for reference:

<slick dots=true custom-paging="customPaging(slick, index)">
  <div verticalBar title="Population"></div>
  <div horizontalBar title="Age Gender"></div>
</slick>

and this customPaging function in my controller:

 $scope.customPaging = function(slick, index){
      return '<button class="tab">' + $(slick.$slides[index]).attr('title') + '</button>';
 };

filter with ng-repeat

Hello,

I'm facing the issue, that I cannot rerender slick when I bind a filter input to my ng-repeat (I use html cards).

As soon as the filter triggers, all items disappear.

Slick current index

Hi, I was trying to show the current index on the view using slickCurrentIndex variable and although on afterChange eventos it is updating, when I use it on view, the value was not updated. What am I doing wrong?

Best regards

Dynamic Settings

I have two carousels in my page, they are inside a ng-repeat.
I need the ability to delete items from it.

Is that possible?

The sync carousel broken with dynamic data.

When I use directive in sync carousel setting when the data is updating the order tag in the carousel messing up. Or with the multiple slidesToShow setting when the data updating by Angular, all the elements not stay inside carousel but instead it move outside and display vertically.

Add an onDirectiveInit handler

The directive sets up a bidirectional control object on scope. This however is done only after .slick() is called on the element. Trying to leverage the control object on slick's settings::onInit throws out undefined errors related to control.<slick-method-property>. This happens because slick's onInit within the .slick() call.

Add an onDirectiveInit attribute to the directive thereby making it possible to use bidirectional control object right after instantiation. This is our solution to performing initialization on first slide element (play on a video, for instance) without asking for another hook in slick's main events API.

timeout before calling init

Hi,

  destroyAndInit = function () {
                        destroy();                     
                            init();

                    };

should be

  destroyAndInit = function () {
                        destroy();
                        $timeout(function () {
                            init();
                        }, 1);
                    };

otherwise, the late items won't be loaded properly and showing alot of double curly brace

on responsive resize ng-click stops working

Hi, I have created a plunkr showing the problem:
Plnkr

Basically I create a list of items with ng-repeat and each of them should execute a function on click. This happens, but only if the starting resolution is bigger than 1024, so the list does not get paginated. If the page is resized to lower than that, items are correctly paginated, but ng-click event stops working.
Also if the page starts in a lower resolution, the ng-click events are not firing.

I think this is a bug, unless you have any other ideas? Would really appreciate some help with this.

Thank you.

TypeError: n.slick is not a function

Hello, I found out type error.

angular.js : 1.4.5
angular-slick-carousel : 3.0.11 - 2015-09-25T12:36:39.625Z

TypeError: n.slick is not a function
    at link.l (angular-slick.min.js:8)
    at link.d (angular-slick.min.js:8)
    at Object.fn (angular-slick.min.js:8)
    at m.$get.m.$digest (angular.js:15715)
    at m.$get.m.$apply (angular.js:15986)
    at angular.js:1658
    at Object.e [as invoke] (angular.js:4473)
    at d (angular.js:1656)
    at yc (angular.js:1676)
    at Zd (angular.js:1570)(anonymous function) @ angular.js:12416$get @ angular.js:9203$get.m.$digest @ angular.js:15733$get.m.$apply @ angular.js:15986(anonymous function) @ angular.js:1658e @ angular.js:4473d @ angular.js:1656yc @ angular.js:1676Zd @ angular.js:1570(anonymous function) @ angular.js:28683a @ angular.js:3018c @ angular.js:3293

Ordering not honored

Despite using ng-repeat directive, and specifying | orderBy : photo.position the slick directive doesn't show the images in the correct order.

global config example

Would you be able to provide an example of how to set the global config for this module?

With ngdialog the config looks like:

someApp.config(['ngDialogProvider', function (ngDialogProvider) {
    ngDialogProvider.setDefaults({
        className: 'ngdialog-theme-default',
        closeByDocument: false,
        closeByEscape: false
    });
}]);

How is this possible with the angular-slick-carousel?

Thanks,
John

duplicate event handlers registered after changing bound data

If you pass event handlers in slick options, e.g.

event: {
          beforeChange: function() {
            console.log("before change called");
            },
          afterChange: function() {
            console.log("after called");
            }
      }

and you change/replace the bounded data.

the event handler get registered each time the data is changed, and the previous doesn't get unregister.
which cause it to be called multiple time (as many times as you've changed data).

you can see a sample here:
http://plnkr.co/edit/qOQ1cOHVPwvxCF933lbm

click the 'update view' button multiple times to add more items to the bounded data list.
and watch the console log window while you move slides with the next/prev arrows.

how to set current slide index?

I am using angular slick and it is working fine. But I have to set the current slide position on run time depending on the api data. There will be some conditions. Sometime it will start from number 2 slide, sometime it can be 4 or sometime it can be from last. Depending upon the position of the data I have to set the current slider position.

How do I set it? The slickgoto is not working in that case. Please help.

slick directive settings attribute not working

Hi, I'm using this on my view:

<slick settings="slickConfig" dots="true" infinite="true" slides-to-show="1" slides-to-scroll="1" prev-arrow="false" next-arrow="false" center-mode="true" center-padding="30px">

and then in my controller I'm using this for the settings:

$scope.slickConfig = {
      event: {
        afterChange: function (event, slick, currentSlide, nextSlide) {
          console.log('slick afterChange', 'event:', event, 'slick:', slick, 'currentSlide:', currentSlide, 'nextSlide:', nextSlide);
        }
      }
    }

The 'afterChange' event is not being fired or the directive is not getting bond to the settings object?

How to reinit the slider when item is added to ng-repeat?

I see the "slickHandle.slickAdd" function is available, this seems to trigger a reinit on the slider.

However, in my case, I'm doing a $watch on my data and as soon as it changes I reloadData(newValue) in order to add the item to the ng-repeat.

This of course breaks the slider as a new item has been added without it reinitializing.

Any idea how I could do this? Once more thanks for your amazing support!

Updating a view inside an existing slide

Hi, here's my issue:

  1. My slider consists of 4 slides.
  2. Each of these slides has a unique 'ui-view' that loads content.
  3. This works fine initially, but when i try to update one of the views:
  4. It doesn't do anything to the existing slide.
  5. It adds another version of the updated slide outside of the slide-track.

In the Elements tab in Chrome tools i can see the 'slick-cloned' slides in 'slide-track'. However it looks like the angular inserted markup e.g. <!-- uiView:slide1 --> remains outside 'slide-track'.

Can anyone suggest how to resolve this issue? Below is how the code looks at different stages:

Original HTML:

<slick settings="slickPanels">
    <div ui-view="slide1"></div>
    <div ui-view="slide2"></div>
    <div ui-view="slide3"></div>
    <div ui-view="slide4"></div>
</slick>

Before view update:

<slick settings="slickPanels">
    <!-- uiView: slide1 -->
    <!-- uiView: slide2 -->
    <!-- uiView: slide3 -->
    <!-- uiView: slide4 -->
    <div aria-live="polite" class="slick-list draggable">
        <div class="slick-track" style="opacity: 1; width: 45000px; transform: translate3d(-1000px, 0px, 0px);" role="listbox">
            <div class="slick-slide slick-cloned" role="option" aria-hidden="false">
                <div ui-view="slide1" class="ng-scope" style=""></div>
            </div>
            <div class="slick-slide slick-cloned" role="option" aria-hidden="false">
                <div ui-view="slide2" class="ng-scope" style=""></div>
            </div>
            <div class="slick-slide slick-cloned" role="option" aria-hidden="false">
                <div ui-view="slide3" class="ng-scope" style=""></div>
            </div>
            <div class="slick-slide slick-cloned" role="option" aria-hidden="false">
                <div ui-view="slide4" class="ng-scope" style=""></div>
            </div>
        </div>
    </div>
</slick>

After update:

<slick settings="slickPanels">
    <!-- uiView: slide1 -->
    <div ui-view="slide1" class="ng-scope"></div>
    <!-- uiView: slide2 -->
    <!-- uiView: slide3 -->
    <!-- uiView: slide4 -->
    <div aria-live="polite" class="slick-list draggable">
        <div class="slick-track" style="opacity: 1; width: 45000px; transform: translate3d(-1000px, 0px, 0px);" role="listbox">
            <div class="slick-slide slick-cloned" role="option" aria-hidden="false">
                <div ui-view="slide1" class="ng-scope" style=""></div>
            </div>
            <div class="slick-slide slick-cloned" role="option" aria-hidden="false">
                <div ui-view="slide2" class="ng-scope" style=""></div>
            </div>
            <div class="slick-slide slick-cloned" role="option" aria-hidden="false">
                <div ui-view="slide3" class="ng-scope" style=""></div>
            </div>
            <div class="slick-slide slick-cloned" role="option" aria-hidden="false">
                <div ui-view="slide4" class="ng-scope" style=""></div>
            </div>
        </div>
    </div>
</slick>

slickness.slick is not a function

Hi, I'm getting this error:

TypeError: slickness.slick is not a function
    at angular-slick.js:167
    at angular.js:17855
    at completeOutstandingRequest (angular.js:5507)
    at angular.js:5784

when trying to repeat over a list of given items, as shown in my following gist

Here's my directive definition and template: https://gist.github.com/JaKXz/367921c102b838221565

Any ideas? I'm poking around the source myself but I'm not sure where to start. Thanks in advance, @devmark !

How to use events

The original kenwheeler library has many events, But I wonder how to use these events in this library. Couldn't find any docs for that.

How to wait for the images to load and then start the carousel?

Hello,

I'm having these issues: the slick carousel doesn't seem to load if the images take longer to load.

How can I initialize the slick carousel after the content is loaded?

If you look on my website, you will see that the images are one under the other. Here is the live exampe: http://mmswi.com/gademm/index.html#/product/51Petit

On my localhost the carousel works fine, but only after I cache it. At the first page load, the images appear one under the other.

In this other plugin (https://github.com/vasyabigi/angular-slick), I see the carousel has something like . Does your plugin have something similar?

Thanks for the help,
Mihai

ng-repeat not working correctly

Hello.
Great job converting this to Angular, just want i was looking for.
Though, i'd like to have the option to add items to the ng-repeat array.
The case i need this for is getting the data i need to show in the carousel async, and later refresh it with the newest data, is this possible to get done ?

I have error

TypeError: slickness.slick is not a function
at angular-slick.js:167
at angular.js:17918
at completeOutstandingRequest (angular.js:5552)
at angular.js:5829

First loading image in centerMode is not filling the left side

I am making slider with variable width and centerMode option set to true. The result is when it first load,the image will start at the center but leaves the left side empty. after a few second when the autoPlay starts, then the slider will fill the empty space.

slide element is removed when bounded data gets changed

Changing a property on a data item which is bound to slick-slide, cause the slide to be deleted.

for example:

js:

    var view1 = { text: "My View1", property: 0 };
    var view2 = { text: "My View2", property: 0 };

    $rootScope.viewData = [view1, view2];

html:

<slick data="viewData">
      <div ng-repeat="view in viewData">
          <div>{{view.text}}</div>
      </div>
</slick>

when changing view1.property value, the slide element gets deleted from DOM.

Here is a plunker with an example:
http://plnkr.co/edit/iDffFOpq5s2Zmpj9q40f?p=preview

you can press the 'update view' button to make 'view*.property' change and see that the slides get removed.
click the button several times to see how it impact all slides.

Error sliding from first to last and last to first

Hi @devmark

If you check your example (index.html) and go from the first slide to the last slide you can see how to the last slide not appears correctly.

One trick is execute unFilter after initialize the slick, but is not very elegant...

I checked the jquery version, slick version and a lot of options but i don't have the correct solution.

Thanks!

Increment Version Number

Duped Info comment in dist file and version number in your generated comment is still on 3.0.2. Would be helpful for that to be synced with the actual version.

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.