move the queuelistrefresh listener to the service, since it gets added multiple times if it's in the controller

This commit is contained in:
Colin Frei 2013-09-26 07:49:01 +02:00
parent 6f0146e159
commit 5afe73a4b2
2 changed files with 6 additions and 6 deletions

View file

@ -92,13 +92,9 @@ function ListItemCtrl($scope, $rootScope, feedItems, downloader, pageChanger)
};
}
function QueueListCtrl($scope, $rootScope, pageSwitcher, feedItems, feeds, downloader, queueList, pageChanger) {
function QueueListCtrl($scope, pageSwitcher, feedItems, feeds, queueList) {
$scope.queue = queueList.getQueueList();
$scope.$on('queueListRefresh', function(event) {
$rootScope.$apply(queueList.rebuildList());
});
$scope.downloadItems = function(updateStatus) {
feeds.downloadAllItems(feedItems, function(feedItem, feed) {
if (feedItem) {

View file

@ -1,6 +1,10 @@
angular.module('podcasts.queueList', ['podcasts.database'])
.run(['queueList', function(queueList) {
.run(['queueList', '$rootScope', function(queueList, $rootScope) {
queueList.rebuildList();
$rootScope.$on('queueListRefresh', function(event) {
$rootScope.$apply(queueList.rebuildList());
});
}])
.service('queueList', ['db', '$rootScope', function(db, $rootScope) {
var queueList = [];