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

Using $emit to sortBy #32

Open
willSonic opened this issue Jan 17, 2015 · 2 comments
Open

Using $emit to sortBy #32

willSonic opened this issue Jan 17, 2015 · 2 comments

Comments

@willSonic
Copy link

Hi,

I am looking for some helping sorting my isotope by Date using $scope.$emit and I am having absolutely no success...

I can sort with a button directive attribute 'ok-sel'
date

I can also use the falling $emit option...
$scope.$emit('iso-option', { sortBy:['original-order']});

However, when I try to do the following ...
$scope.$emit('iso-option', { sortBy:['date']});
absolutely nothing....

Could somebody possible point me toward an example using sortBy with $scope.$emit.

I am not using jquery with my angular project ... so it would be awesome to have a gander at one sans jquery... but I am so desperate any will do thank you ...

Thanks...
Will

@johanbenschop
Copy link

I know this post is a couple of months old, but I was facing the same issue as the OP. Due to the lack of documentation around this project I looked at the sourcecode for answers and I figured out what angular-isotope does with the ok-sel and ok-type attributes.

The solution appears to be simple: just add opt[*]. For example:
$scope.$emit('iso-option', { sortBy: ['opt[date]'] });

@markdturner
Copy link

Sorry to resurrect this post, but does anyone know if it possible to trigger a sort direction in this way?

I've tried both $scope.$emit('iso-option', { ascending: ['opt[$scope.sortAscending]'] }); and $scope.$emit('iso-option', { ascending: $scope.sortAscending }); but it doesn't seem to do anything. I could add the ascending=false to each of my sort buttons but that would double the number of buttons, I'd rather choose a sort property and then choose the direction.

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

3 participants