angularangular-servicesangular-routerurlsearchparamsangular-router-params

Using Common Service Variables or Route Parameters


I have a Angular application, which has multiple components that access the same Service.

I am trying to understand if there is any benefit to switching away from using route parameters to using variables in the common service?


Solution

  • I am trying to understand if there is any benefit to switching away from using route parameters to using variables in the common service?

    Route params and query params holding state:

    Storing state in services:

    Disadvantages:

    Key Takeaways: