Better config loading

This commit is contained in:
Vit Brunner
2014-10-12 14:30:19 +02:00
parent d1411f1b20
commit 8d1a0d2773
2 changed files with 10 additions and 2 deletions
@@ -7,7 +7,15 @@ angular.module("sideBySide.controllers", [])
then '/' + $previousRoute.params.base
else ''
base = $location.url().replace(/\/(.*)\/.*/, '$1')
appUrl = $location.absUrl()
.substring(0, $location.absUrl().length - $location.url().length)
.replace(/#$/, '')
base = appUrl + $location.url()
.slice(1)
.replace(/(.*)\/.*/, '$1')
.replace(/\./g, '/')
poems.load base
]
@@ -14,7 +14,7 @@ angular.module("sideBySide").service "poems", ['$q', 'fetch', ($q, fetch) ->
(poem for poem in @all when poem.meta.Active is true)
@load = (base = '') =>
config = base.replace(/\./g, '/') + "/config.json"
config = base + "/config.json"
fetch(config).then (result) =>
$q.all(result.promises).then (results) =>