Skip to content

Instantly share code, notes, and snippets.

@DavidSouther
Created January 30, 2015 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidSouther/c5213d3a3ec09a9ff2ca to your computer and use it in GitHub Desktop.
Save DavidSouther/c5213d3a3ec09a9ff2ca to your computer and use it in GitHub Desktop.
Song Flux 6 - LibraryComponent
function LibraryController(Library, Actions) {
this.Library = Library; // A library has albums, which have tracks
this.albums = Library.albums; // Updates on Library mutation events
this.Actions = Actions;
}
LibraryController.prototype.play = function(track) {
return this.Actions.Play(track).dispatch();
};
LibraryController.$inject = ['TrkstrLibrary', 'TrkstrActions'];
<ol ng-repeat="album in state.albums">
<li>{{ album.name }}</li>
<li
ng-repeat="track in album.tracks"
ng-click="state.play(track)"
>{{ track.title }}</li>
</ol>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment