Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng-click is disabled #53

Open
sinjaz opened this issue Jan 4, 2015 · 7 comments
Open

ng-click is disabled #53

sinjaz opened this issue Jan 4, 2015 · 7 comments

Comments

@sinjaz
Copy link

sinjaz commented Jan 4, 2015

I have multiple elements inside each slide with ng-click's attached to them. They all seem to be disabled. Anyone know how I can enable them or possible workarounds?

@sinjaz
Copy link
Author

sinjaz commented Jan 5, 2015

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.

@sylvanash
Copy link

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

@sinjaz
Copy link
Author

sinjaz commented Jan 7, 2015

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>

@sylvanash
Copy link

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

@jhjwind
Copy link

jhjwind commented Feb 23, 2015

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

@sylvanash
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants