Created
May 15, 2013 11:57
-
-
Save josepjaume/5583459 to your computer and use it in GitHub Desktop.
Get hash location from URL as a fallback on Ember.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HashLocationFromUrl = Ember.HashLocation.extend({ | |
getURL: function(){ | |
var location = this.get('location'); | |
if(location.hash){ | |
return get(this, 'location').hash.substr(1); | |
}else{ | |
return this.get('location').pathname; | |
} | |
} | |
}); | |
Ember.Location.registerImplementation('hashFromUrl', HashLocationFromUrl); | |
App.Router.reopen({ | |
location: 'hashFromUrl' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment