I want to provide a constant in my application basing on QueryParam from url.
localhost:4200?flag=true
In my module providers I added
{ provide: FLAG, useFactory: FlagFactory, deps: [...] }
So I am interested if there is a way how to do it without parsing url manually
function FlagFactory() {
return location.search.includes('flag');
}
What about using Angular Router?
The router tracks query parameters, so they should be available on you initial route '/'
your root component could have a route that allows this