Code Monkey home page Code Monkey logo

Comments (7)

sinjaz avatar sinjaz commented on June 27, 2024 1

After testing some more I found out the ng-click is in fact NOT disabled. The issue is accessing the outer scope which has the definition of the click function. Since the SLICK directive creates its own scope the outer scope is never reached. So the question is how to access to outer (parent) scope, similar to defining the 'data' attribute. Any help would be appreciated.

from angular-slick.

sylvanash avatar sylvanash commented on June 27, 2024

Not sure if it will work, but you could try placing the function inside a model on the scope instead of on the scope directly. So instead of:
$scope.myfunction = function () {....}
You could try something like:
var myfunction = function () {....};
$scope.myobject = { clicked: myfunction };

Again, I haven't exactly tried this, it's just a suggestion

from angular-slick.

sinjaz avatar sinjaz commented on June 27, 2024

I was able to resolve this by passing the scope to slick as the data attribute. This allowed me to access multiple properties of the scope, including functions and model objects.

// 'this' is a reference to $scope
<slick data=this>
    <div ng-click="data.clickHandler()">{{data.model}}</div>
<slick>

from angular-slick.

sylvanash avatar sylvanash commented on June 27, 2024

A good thing you are not working with dynamic data then xD

from angular-slick.

jhjwind avatar jhjwind commented on June 27, 2024

This hack doesn't work with dynamic data. Neither does adding function to the object.

from angular-slick.

sylvanash avatar sylvanash commented on June 27, 2024

@jhjwind I think I worked with something similar. I'll see if I can find a working bit of code later on and post it some time today

from angular-slick.

amrfaisal avatar amrfaisal commented on June 27, 2024

Check my answer for Angular use-case:
http://stackoverflow.com/questions/29101254/angularjs-slick-js-carousel-ng-click-not-firing-with-responsive-attribute-settin/30584787#30584787

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.