Can anybody please explain in step by step manner, how can we remove # from URL in Aurelia
Use clean, fine-tipped tweezers to grasp the tick as close to the skin's surface as possible. Pull upward with steady, even pressure. Don't twist or jerk the tick; this can cause the mouth-parts to break off and remain in the skin. If this happens, remove the mouth-parts with tweezers.
The easiest and simplest way to make a tick back out is to detach it manually with tweezers. Grasp the tick with the tweezers as close to the skin's surface as possible. Pull the tick upward with steady, even pressure without twisting the tick.
Do not twist the tick when pulling it out. Do not try to kill, smother, or lubricate the tick with oil, alcohol, petroleum jelly, or similar material while the tick is still embedded in the skin.
The feature you are looking for is called PushState. You can find more info in Cheat Sheet section of Aurelia Hub. Just scroll down to Routing
/ Configuring PushState
.
Add a base tag to the head of your HTML document. I don't think this is a required step, since my apps are working without it.
If you are using JSPM, configure baseURL
(in config.js
file).
Enable PushState in router config:
export class App {
configureRouter(config) {
config.title = 'Aurelia';
config.options.pushState = true; // <-- this line
config.map([
//...
]);
}
}
Configure server to support PushState. Basically, this means that your server should redirect all unknown routes/URLs to the home URL (the address of your Aurelia app - index.html
, /home/index
...).
This step depends on the server-side technology you are using. I.e. for ASP.NET MVC, this is how you would define your route config:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
// url: "{*pathinfo}" - this redirects all server side calls
// to Home/Index (default route)
// with this single change, HTML5 push state is enabled
routes.MapRoute(
name: "Default",
url: "{*pathinfo}",
defaults: new {
controller = "Home",
action = "Index",
id = UrlParameter.Optional
}
);
}
}
Edit: Dwayne Charrington has a nice article about PushState on his Discover Aurelia site, where he explains how to configure PushState on various server-side frameworks, like Apache, Nginx, .NET Core and Node.js Express.
If you looking for a quick way to make it work do the following:
in router config in src/app.ts
:
config.options.pushState = true;
in index.html of root directory add the following :
<base href="/">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With