0

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
0

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks Kushal for the link. I actually referred the same before posting question
Its a great guide for starting with angular!!
Yes.. Modularity the core of angular application

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.