Code Monkey home page Code Monkey logo

Comments (7)

heshamelmasry77 avatar heshamelmasry77 commented on July 30, 2024 2

not working
screen shot 2017-12-04 at 10 49 34 pm

from angular-slick-carousel.

 avatar commented on July 30, 2024 1

Hi,

had the same problem, it's connected to angular.element() VS $(), as soon as i changed the line 143 of angular-slick.js, all worked fine.
The problem is at line 167, were "slickness.not()", this function on selected element does not exist angular.element().not().

here's what i changed to get it to work:
Line 140.
init = function () {
initOptions();

        var slickness = $(element); // VS var slickness = angular.element(element);

This is true for "angular": "^1.6.6", don't know if the ".not()" existed before or not, But on this jQueryLite version of this [email protected] it does not exist.

Don't know who or how this directive was tested, but this seems like an error everybody should have unless as i stated before, the ".not()" method existed before.

Cheers.


UPDATE

Forgot to mention, you also have to change this line (same concept)
Line 131.
destroy = function () {
var slickness = $(element); //angular.element(element);

from angular-slick-carousel.

svindler avatar svindler commented on July 30, 2024

I had the same problem.

Put this to my webpack config:

new webpack.ProvidePlugin({
'window.jQuery': 'jquery',
'windows.&': 'jquery'
});

And this as my first import before angular:

import {$,jQuery} from 'jquery';
window.$ = $;
window.jQuery = jQuery;

from angular-slick-carousel.

 avatar commented on July 30, 2024

That's because angular-slick-carousel depends on slick-carousel.

You need to install it first:
https://www.npmjs.com/package/slick-carousel

Then import it in your app:

import slickCarousel from 'slick-carousel';

from angular-slick-carousel.

ohabash avatar ohabash commented on July 30, 2024

none of this works. this is going on 2 days. help!.... the only solution I am not sure I tried is new webpack.ProvidePlugin({ because i dont know how it fits in webpack.config.js... Can someone explain to a beginner the how and whys of that solution? THank you!

from angular-slick-carousel.

peterfiorito avatar peterfiorito commented on July 30, 2024

as @pjsalsantos said, angular works with jqlite; Even with jquery loaded in the project, .not() used inside the directive will bring problems.
Just replace angular.element() with jquery's $(element).. or alternatively, refactor the code to avoid using the .not() property.
This will solve the issue.

from angular-slick-carousel.

EvanLomas avatar EvanLomas commented on July 30, 2024

To fix this issue in the mean time, load JQuery BEFORE Angular so angular uses the full JQuery library
ie if you are using a cdn method:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
...
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.10/angular.js"></script>
...
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.9.0/slick.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-slick-carousel/3.1.7/angular-slick.js"></script>

This way Angular replaces the jquery-lite library inside angular.element() with the full jquery equivalent of $() as documented here:
https://docs.angularjs.org/api/ng/function/angular.element#overview

If you use a bundling system, check the documentation for ordering your scripts in a similar manner

from angular-slick-carousel.

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.