Move to fetch

This commit is contained in:
Vit Brunner
2014-10-12 20:56:49 +02:00
parent e3074787c3
commit 4cdf113251
2 changed files with 5 additions and 5 deletions
@@ -1,4 +1,4 @@
angular.module("sideBySide").factory "fetch", ['$http', 'readerFactory', ($http, readerFactory) ->
angular.module("sideBySide").factory "fetch", ['$http', '$q', 'readerFactory', ($http, $q, readerFactory) ->
# Fetch
#
# @param file [String] Path to config file
@@ -10,7 +10,7 @@ angular.module("sideBySide").factory "fetch", ['$http', 'readerFactory', ($http,
readerFactory(poem) response.data
{
promises: promises
fetchPoems: $q.all promises
heading: config.data.heading
active: config.data.active
}
@@ -1,4 +1,4 @@
angular.module("sideBySide").service "poems", ['$q', 'fetch', ($q, fetch) ->
angular.module("sideBySide").service "poems", ['fetch', (fetch) ->
@all = [{
meta: {
Active: true
@@ -34,8 +34,8 @@ angular.module("sideBySide").service "poems", ['$q', 'fetch', ($q, fetch) ->
# @param base [String]
@load = (base = '') =>
fetch(base + "/config.json").then (config) =>
$q.all(config.promises).then (results) =>
@all = (activize(poem, config.active) for poem in results)
config.fetchPoems.then (poems) =>
@all = (activize(poem, config.active) for poem in poems)
@heading = config.heading
@