mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-09 11:34:24 +08:00
Make work with hash urls (no html 5)
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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' }
|
||||
|
||||
Reference in New Issue
Block a user