Navigation.go supports full URLs

This commit is contained in:
Rohan Mitchell
2014-06-27 11:51:53 +10:00
parent b678a2f7fd
commit 4075854440
2 changed files with 24 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
Darkswarm.factory 'Navigation', ($location) ->
Darkswarm.factory 'Navigation', ($location, $window) ->
new class Navigation
path: null
@@ -10,7 +10,6 @@ Darkswarm.factory 'Navigation', ($location) ->
$location.path(@path)
toggle: (path = false)=>
console.log "toggling"
@path = path || @path
if $location.path() == @path
$location.path("/")
@@ -18,4 +17,7 @@ Darkswarm.factory 'Navigation', ($location) ->
@navigate(path)
go: (path)->
window.location.pathname = path
if path.match /^http/
$window.location.href = path
else
$window.location.pathname = path