mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-10 12:37:06 +08:00
Abstract route service
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
]
|
||||
Reference in New Issue
Block a user