angularangular-routingangular-auxiliary-routes

How to serialize Angular URL with auxiliary routing?


Currently what is being happening is, when you navigate to any aux route the URL page will be

my-url/(router-name:aux)

What I want is, it should be something like

my-url/router-name/aux

Is this even logical? I don't know if it will contradict with any primary routing.

Thanks


Solution

  • I've just used URLSerializer provided by Angular itself. You can find the official docs here.

    All we need to do here is parse URL to actual one, and serialize the parsed URL to desired one and both can be achieved via UrlSerializer methods (parse and serialize respectively).