Deepak Ingole
Deepak Ingole

Reputation: 15732

angular UI - Router

I have an application with more than 1500 pages. I am using angular UI Router for handling routing.

I want to know what is the good practice

  1. Define all routes in app.js
  2. Define routing per module

Upvotes: 0

Views: 179

Answers (1)

Kushal
Kushal

Reputation: 1360

My personal recommendation would be to define routing per module as this will simplify the code for the maintainability perspective

From John papa's reference guide

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.

you can refer John papa's angular guide here

Upvotes: 5

Related Questions