mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-09 11:34:24 +08:00
Move to fetch
This commit is contained in:
@@ -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
|
||||
|
||||
@
|
||||
|
||||
Reference in New Issue
Block a user