How to make it so that in Angular, you can use the plus sign in the path.
For example: http://localhost:4200/how+to+do
Instead, angular changes plus to %2B
For example: http://localhost:4200/how%2Bto%2Bdo
How to fix it?
How to make it so that in Angular, you can use the plus sign in the path.
For example: http://localhost:4200/how+to+do
Instead, angular changes plus to %2B
For example: http://localhost:4200/how%2Bto%2Bdo
How to fix it?
Angular's default routing configuration automatically converts certain characters, such as plus signs, in URLs. To prevent this automatic conversion, you can modify your application's routing configuration.
To disable the automatic conversion of plus signs, you can add the useHash parameter to the forRoot method in the routing module and set its value to true. This will enable "routing hash" in the app, meaning the URL will have a # sign in front of the routing path. Using hash routing ensures that plus signs are not automatically converted to %2B.
@NgModule({
imports: [RouterModule.forRoot(routes, { useHash: true })],
exports: [RouterModule]
})