I am using an Angular 2 Router to update the query params in a URL for a search application. I am attempting to replace spaces in a query with + signs. However, + signs are
I ran into an issue specifying the custom provider. There was apparently a circular dependency when compiling with the --prod flag causing an error with the text: useClass cannot by null. This is how I worked around that error:
In AppModule, define the following:
const customUrlSerializer = new CustomUrlSerializer();
const CustomUrlSerializerProvider = {
provide: UrlSerializer,
useValue: customUrlSerializer
};
Then in the providers array, add the provider you specified above.
...
providers: [CustomUrlSerializerProvider]
...