diff --git a/source/documents/scripts/services/fetch.js.coffee b/source/documents/scripts/services/fetch.js.coffee index ac47ece..4ddb3dd 100644 --- a/source/documents/scripts/services/fetch.js.coffee +++ b/source/documents/scripts/services/fetch.js.coffee @@ -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 } diff --git a/source/documents/scripts/services/poems.js.coffee b/source/documents/scripts/services/poems.js.coffee index 3294f5b..5c88f8c 100644 --- a/source/documents/scripts/services/poems.js.coffee +++ b/source/documents/scripts/services/poems.js.coffee @@ -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 @