Giter Club home page Giter Club logo

angular-flickity's People

Contributors

benjamincharity avatar kukac7 avatar nhardy avatar

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

Watchers

 avatar  avatar  avatar  avatar

angular-flickity's Issues

Expose events from directive.

  • Events
    • cellSelect
    • settle
    • dragMove
    • dragEnd
    • pointerDown
    • pointerUp
    • staticClick
    • lazyLoad

Notes

  • Events should not be wired/broadcasted unless asked for by the instance options or provider options.

I want to use it with other attributes, not with images

Hi, great work. Especially documentation is great. I want to use flickity with angular material's md-card attribute so not with images. I tried it but it did not create a gallery. Here what I want to achieve:

zgm0k

My case:

<div bc-flickity="{{myCustomOptions}}" >
<md-card data-ng-repeat="photo in slides">
    <a ui-sref="baba.icerik({ad:photo.isim})"><img data-ng-src="{{photo.isim}}.jpg"></a>
</md-card>
</div>

screenshot_1

Flickity viewport created after cell elements

Hello Benjamin,
I'm trying to use Flickity in my angularjs project.
However, after setting my slider like this

<div bc-flickity="{{sliderOptions}}">
    <figure ng-class="'slide background-image'" data-ng-repeat="photo in module.gallerie">
        <img ng-src="{{photo.url}}">
    </figure>
</div>

The HTML output is like that :
unspecified

The flickity seems to be instanciate. But the cells aren't in the right place (before the flickity-viewport div)

Timeout delay before the destroy event is too long

When using the Flickity service to create an instance inside a UI-Router view's controller, we also need to be destroying it using the $destroy event. The long $timeout delay in FlickityService.destroy() causes issues if switching quickly between pages. This should be ~10x shorter.

Can not inject bc.Flickity

I am struggling with this for 2 days now, i installed flickity first with npm , and it was not working, then again with bower and made the changes you say but again the same problem,Module 'bc.Flickity' is not available

v2.0.1 - Options on bc-flickity attribute are completely ignored

Issue:
Assigning options from the constructor and passing them on the directive argument on the template does not work and ignores all the settings.

Code example (ES6):

export default class CarouselController {

  constructor(FlickityService) {
    this.flickityOptions = {
      cellSelector: '.child-slide',
      setGallerySize: true,
      prevNextButtons: false,
      imagesLoaded: true,
      pageDots: false,
      wrapAround: true
    };
  }
}
.carousel-component(bc-flickity="{{ $ctrl.flickityOptions }}")
  .child-slide(ng-repeat="item in $ctrl.items")
    image-component(image="item.image", url="item.url")

Result:
prevNextButtons, imagesLoaded, pageDots, wrapAround options are ignored and the default setting is always displayed

Demo (forked from your demo):
http://plnkr.co/edit/sU6VoIz7UyODu8Rcxs0k?p=preview

Workaround:
Downgrade to v2.0.0

dist not up to date

the dist folder is outdated. So when I install from bower I get an old version.

Next/Previous buttons not disabled on initialization when there are not enough slides

It looks like the bc-flickity-previous and bc-flickity-next directives do not initialize as disabled, even if there are not enough slides to scroll. It looks like the functions defined here: https://github.com/benjamincharity/angular-flickity/blob/master/src/previous/previous.directive.js#L71 and here: https://github.com/benjamincharity/angular-flickity/blob/master/src/next/next.directive.js#L73 need to be called when Flickity is initialized.

Add tests

  • Test service
  • Test directives
  • Test controller
  • Hook up CodeClimate
  • Set up build with CircleCi

Call out that Flickity needs to be overwritten in bower.json

Simply installing via bower never seems to work. Overriding the main with the dist files seems to fix this.

bower.json:

  "name": "myProject",
  ...
  "overrides": {
    "flickity": {
      "main": [
        "dist/flickity.pkgd.js",
        "dist/flickity.min.css"
      ]
    }
  }

Initialize slider "after" loading remote data

Hi @benjamincharity,

Thanks for making this wonderful plugin. I am trying to get the slider work with Remote data (after $http call), but I am facing an issue.

The wrapper divs (flickity-viewport and flickity-slider) get initialized first and treat the remote data array as an Empty Array. After this, the remote data load get completed and the slides get loaded "before" the wrappers but inside the correct parent.

When i hardcode the Remote Data in the Array directly, everything works. But on including it as a $http call, it fails. I even tried using the service options "after" the $http promise is resolved, but still get the same error.

Is there a way to specify the reload based on some criteria after array is initialized with remote data?

Angular-Flickity does not properly initialize using the directive inside Angular-UI-Router's UI-View

Using Angular 1.5 / Angular-UI Router 0.2.x

Similar to this issue here:
metafizzy/flickity-docs#4

When initializing Flickity using native javascript / jquery the gallery inits correctly, but allowing the directive to do the initialization, the gallery is stacked vertically on top of itself and no functionality is working.

This only happens inside a Angular-UI Routers "UI-View" that is pulling in a "templateURL" if you move the directive outside the UI-View it works or if you alternatively define a inline template with UI-Router, it works.

A workaround was for me to initialize the gallery with the Service inside of the corresponding Controller of my UI-View.

$timeout(function() {
    FlickityService.create('.demo__slides', $scope.flickityId, $scope.flickityOptions)
},0);

Working CodePen with INLINE template and UI-Router
i don't have a way to make a codepen with a external template to show it not working.

Bower Resolution Issue

I am trying to use Angular-Flickity but running into some version issue. I have specified following in my bower.json file.

"angular-flickity": "2.0.0",

I haven't explicitly specified "flickity" version in bower.json.

when I run bower install, I see following.

angular-flickity#2.0.0 web/src/main/webapp/bower_components/angular-flickity
โ”œโ”€โ”€ angular#1.5.8
โ””โ”€โ”€ flickity#1.2.1

It's resolving to 1.2.1 version of flickity.

Do I need to explicitly specifiy flickity version in my bower.json?

Directives should expose flag for enabling/disabling button

  • Expose isDisabled flag when wrapAround is false.
    • Next: isDisabled should be true when at the at the last cell.
    • Previous: isDisabled should be true when at the at the first cell.
  • Add docs showing how to use the flag to disable the button and add a class

index/$timeout in destroy w/ remote calls

I read #39 and tried that approach. I have an interactive search that returns items with images. Based on the map drag or filters changed, results could have common items. So, I had to destroy instances in order to recreate them since their id would be the same. Because of $timeout in FlickityService.destroy, the destroy was happening after the next create cycle from the next api call, which was making flicketyIndex be outdated since the next create cycle added more instances and the array splicing eventually changed the order of the array causing errors.

I tried to remedy with promises and such but it was getting difficult with all the create and destroy promises happening at different times.

I changed the destroy code to be this to see how it functions (I moved index get inside promise and removed $timeout).

value: function destroy(id) {
    var _this2 = this;

    return this.$q(function (resolve, reject) {

        var flickityIndex = _this2._getFlickityIndex(id);

        if (flickityIndex < 0 || !_this2.instances[flickityIndex]) {
            reject('Instance ' + id + ' not found');
        }

        // Destroy the Flickity instance
        _this2.instances[flickityIndex].instance.destroy();

        // Remove the instance from the array
        _this2.instances.splice(flickityIndex, 1);

        resolve('Instance ' + id + ' destroyed.');
    });
}

With this change, I'm simply using your directive inside the results/ng-repeat and letting angular control the init/destroy lifecycle when the scope changes. So far its working very well.

I know you had a reason for $timeout in destroy but wanted to make you aware of this edge case and the problems that $timeout was causing with the instances array.

I also think the getFlicketyIndex should be inside the promise, right before the destroy in case the array order changes.

Revisit using native promises

Currently have a mix of both $q and ES6 Promises. There should be consistency throughout the module (one way or another).

$q

  • ๐Ÿ‘ Better IE support (IE9 and up)
  • โ“ Tied directly in with AngularJS

ES6 Promises

  • ๐Ÿ‘ Vanilla JS
  • ๐Ÿ‘Ž Needs polyfill for IE

Note: If native promises are chosen, clear instructions for enabling IE support should be added to the docs.

staticClick event data does not surface all parameters

It's difficult to make use of the staticClick event because it does not provide the parameters of the event from the underlying API (pointer, cellElement, cellIndex). These are needed to determine which item was clicked. Is there a way to retrieve these using the existing code?

Prev / Next Button Issue

I am trying to use multiple sliders of Flickity in my single view. For some reason, Prev and Next Arrows are not showing for all the Flickity sliders. It only shows up for one of the Flickity slider and where it shows up, it ends up controller different slider.
Any idea?

Problem with ng-repeat

Hello @benjamincharity

When I don't use ng-repeat - just plain HTML - everything works like a charm.
But I have a problem when using ng-repeat with bc-flickity directive. It seems it runs after bc-flickity postLink is finished.
I put a breakpoint in this line https://github.com/benjamincharity/angular-flickity/blob/master/src/flickity.directive.js#L53 to find out that:

  1. When using plan html (listing all slides literally) - element[0] contains all slides DOM elements. As expected, nothing fancy here.
  2. But when I use ng-repeat - element[0] is empty.

I saw one of yours examples: http://plnkr.co/edit/qdyKKo?p=preview
and I implemented it in my code, and it does not work either for me. Which brings me to conclusion that there might be something wrong with my code.
The problem is that this is a code that was handed over to me, and I'm not really sure what can cause this issue.

This might not be a bug of your code at all, but I'd appreciate any help/hints from you.

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.