Closed chandu closed 5 years ago
On line 244 replace with following code:
if (root.location.hash) {
frag = root.location.hash.split((self.options.hashBang ? '#!' : '#'))[1]
}
else {
root.location.hash = (self.options.root) ? self.options.root : '#/';
frag = root.location.hash.split((self.options.hashBang ? '#!' : '#'))[1]
}
Thanks for the simple/awesome router.
I looked at the documentation/code and realized that the options.root is only applicable for the pushState mode.
Can this be made applicable to the regular non pushState mode too?
I am aware that router.context(), can help me here, router.context returns only a wrapper to router.get.
I think that the frag.get/set methods needs to be changed to use the options.root for the non pushState mode, but am not good with the pushState/JS tests and don't want to waste your time sending a pull request without test coverage :(