Pony.fm/public/scripts/app/controllers/tracks-list.coffee

19 lines
528 B
CoffeeScript
Raw Normal View History

2013-07-31 13:47:16 +02:00
window.pfm.preloaders['tracks-list'] = [
'tracks', '$state'
(tracks, $state) ->
tracks.loadFilters().then(->
2013-07-31 13:47:16 +02:00
if !tracks.mainQuery.hasLoadedFilters
tracks.mainQuery.fromFilterString($state.params.filter)
if $state.params.page
tracks.mainQuery.setPage $state.params.page
tracks.mainQuery.fetch()
)
2013-07-31 13:47:16 +02:00
]
angular.module('ponyfm').controller "tracks-list", [
'$scope', 'tracks', '$state',
($scope, tracks, $state) ->
tracks.mainQuery.fetch().done (searchResults) ->
$scope.tracks = searchResults.tracks
]