Make work with hash urls (no html 5)

This commit is contained in:
Vit Brunner
2015-03-09 20:48:05 +01:00
parent 451309bc15
commit eb793193d2
2 changed files with 9 additions and 2 deletions
+4 -2
View File
@@ -19,8 +19,10 @@ angular.module("sideBySide").service "route",
@params.base = '' if 'base' not of @params
@appUrl = $location.absUrl()
.substring(0, $location.absUrl().length - $location.url().length)
absUrl = $location.absUrl()
@appUrl = absUrl.substring(0, absUrl.length - $location.url().length)
if @appUrl.substring(@appUrl.length - 2) == '/#'
@appUrl = @appUrl.substring(0, @appUrl.length - 2)
getValue = (value) ->
if typeof value == 'object'
+5
View File
@@ -47,3 +47,8 @@ test "adds base before section", ->
setup('http://example.com', '/section:7', '')
route.update('base', 'the_raven')
equal route.get(), 'base:the_raven/section:7'
test "works with hash url", ->
setup('http://example.com/#', '/base:asdf', '')
deepEqual route.appUrl, 'http://example.com'
deepEqual route.params, { 'base': 'asdf' }