Pony.fm/public/scripts/app/controllers/track.coffee

18 lines
561 B
CoffeeScript
Raw Normal View History

window.pfm.preloaders['track'] = [
2013-08-01 04:01:41 +02:00
'tracks', '$state', 'playlists'
(tracks, $state, playlists) ->
$.when.all [tracks.fetch $state.params.id, playlists.refreshOwned(true)]
]
angular.module('ponyfm').controller "track", [
2013-08-01 04:01:41 +02:00
'$scope', 'tracks', '$state', 'playlists', 'auth'
($scope, tracks, $state, playlists, auth) ->
tracks.fetch($state.params.id).done (trackResponse) ->
$scope.track = trackResponse.track
2013-08-01 04:01:41 +02:00
$scope.playlists = []
if auth.data.isLogged
playlists.refreshOwned().done (lists) ->
$scope.playlists.push list for list in lists
]