-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request - Allow us to change the "!" character in route to "/" #195
Comments
With 5.0, you could change this "relatively" easily by forking https://github.com/canjs/can-route-hash/blob/master/can-route-hash.js and then swapping You could then set an instance of that observable to import {route} from "can";
import YourHash from "./your-hash";
route.urlData = new YourHash(); Btw, since those values are already on the prototype, have you tried changing them locally? import HashObservable from "can-route-hash";
var hash = new HashObservable();
hash. root = "#/";
route.urlData = hash; |
I tested the second method, it doesn't appear to work. The initial "/" changes back to an ! after initializing. The second method, I could get working: 16: return loc.href.split(/#\/?/)[1] || '';
41: root: '#/',
65: loc.hash = '/' + path; |
Btw, I totally support this feature. What do you think an API to make it work should look like? |
To be honest, I'm not sure why the ! is in the route to begin with. I'm sure there's a reason but I'd like the route.register to match the actual route. So I'd say the api would look like this: route.register('/{id}/action/{action}'); // --> #/8/action/add
route.register('!whatever/{id}'); // --> #!whatever/8
route.register('{id}/action/{action}'); // --> #8/action/delete This would be a breaking change though...so I'm not saying this is the way to go but that's what I'd say is the most flexible. Then I wouldn't need a starting character at all if I don't want one. |
Open for discussion but I think a url in a route using the slash character instead of the ! character would be more readable.
vs
The text was updated successfully, but these errors were encountered: