Routing

Client-side routing is important for creating a navigation flow between views and composing views that are made of many smaller templates and directives.

[Style Y270]
  • Use the AngularUI Router for client-side routing.

    Why?: UI Router offers all the features of the Angular router plus a few additional ones including nested routes and states.

    Why?: The syntax is quite similar to the Angular router and is easy to migrate to UI Router.

[Style Y271]
  • Define routes for views in the module where they exist. Each module should contain the routes for the views in the module.

    Why?: Each module should be able to stand on its own.

    Why?: When removing a module or adding a module, the app will only contain routes that point to existing views.

    Why?: This makes it easy to enable or disable portions of an application without concern over orphaned routes.