Hey,
In Client side Routing there are several way of achieving Routing but the common one is:
Both the router provides the routing concept but most of the developer using the UI-Router because of the having more flexibility and provide more feature and capability than ngRoute.
- UI-Route is build by Angular team.
- It fully replace ngRoute and is more powerful than ngRoute
- It is developed around the state which is opposed to ngRoute
In Short we can say that UI-Route describes how the UI looks like when navigation occur or when a route is triggered or when we switched to different route.
So We can have the most important advantages of UI-Router over ngRoute as follow:
- Multiple views: There is no support for multiple view in ngRoute. You should always work with only one ngView which you need to replace forever and nesting of ngview is quite so complicated but not impossible but in case of UI-router you can have multiple view sitting together in parallel or nested them to any numbers of levels.
- Nested state: When you are defining the state it is just not limited to a particular state, you can further enhanced that state to children as well in UI-Router but the state concept is not available in ngRoute.
- Association : In UI-Router there is availability of association between controller/scope to nested state/ views but this is not in case of ngRoute.
Thank you!!