Siraj E A Siraj E A - 1 year ago 76
jQuery Question

angularjs update a single element from a huge list

Hi i am new to angularjs. I am using angular version 1.
I have and application which plays music over http.

So it basically displays thousands of songs in a list as thumbnail in which each tile contain play/pause buttons.
Also there is a footer on mini player which contain play/pause/next buttons

So my requirement is that how to switch the play/pause buttons on tile from this huge list.

Right now i am assigning track id as id for each tile and update the element by switching class with jquery. It takes too much time to update the list.

Can anyone tell me the best solution for this.
Thanks in advance.

here is my sample code

var item = $('.pause-btn')


$('div').find("[data-index='" + btoa('track_' + CurrentSongId) + "']").addClass('pause-btn')

Answer Source

I would use the following sample

    <p class=track.isPlaying==true?'pause':'play' ng-click=update(track)>
    <img src="albumart.jpeg">

//on controiller
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download