mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-22 13:40:40 +08:00
18 lines
451 B
CoffeeScript
18 lines
451 B
CoffeeScript
angular.module("sideBySide").service "route", ['$location', ($location) ->
|
|
@params = $location.url()
|
|
.split('/')
|
|
.filter((item) -> item)
|
|
.map (item) ->
|
|
item.split(':')
|
|
.reduce((params, param) ->
|
|
params[param[0]] = param[1]
|
|
params
|
|
, {})
|
|
|
|
@params.base = '' if 'base' not of @params
|
|
@params.base = @params.base.replace(/\./g, '/')
|
|
|
|
@appUrl = $location.absUrl()
|
|
.substring(0, $location.absUrl().length - $location.url().length)
|
|
]
|