jxnblk / plangular

Create custom SoundCloud players with HTML & CSS
http://jxnblk.github.io/plangular
480 stars 93 forks source link

Alternative to playPause(i) for filtering purposes? #63

Closed shazzygh closed 6 years ago

shazzygh commented 9 years ago

Hey,

I am trying to filter a playlist, but as a result the index doesn't follow up and playPause($index) triggers the wrong tracks. I tried passing the track object instead: playPause(track) or playPause(track.src) as pointed out here http://codeutopia.net/blog/2014/11/10/angularjs-best-practices-avoid-using-ng-repeats-index/

However it doesn't seem to work and the console shows Cannot read property 'src' of undefined I assume plangular is not coded with filtering in mind or am I doing something wrong?

My filter looks like this <div ng-repeat="track in tracks | filter:{ title: 'XXX' }"> (the filtering part works)

Best, shazzy

jxnblk commented 9 years ago

Interesting. I don't think I realized that's how Angular's $index worked with filtering. I can look into ways to handle this, but it sounds like it currently doesn't support filtering.

I'd have to also figure out a way to ensure the next() previous() methods still work in this case – if you have any insights into that problem.

seanohue commented 9 years ago

Perhaps if there were a check to see if the parameter was the track object rather than $index, then it could just play that specific track? I am having a similar issue where I only want to display one track at a time and while the track and duration switches to the next track in the playlist, none of the other information updates in the view. This may or may not be a related issue (probably not, though).