-1

I am doing a project for myself to learn. And today I got a question. As I am building up on code, I create more modules, so that app.module wouldn't be just a big pile of component imports. And I think it makes project and code more readable and easier maintained. So my question is, should I also make more than one routing file, like within module, or should it be just one?

Thanks!

4

2 回答 2

2

Generally speaking; its better practice to have a routing module for each feature module. This keeps the app module clutter free.

Something to keep in mind: it is necessary to have separate routing modules in order to facilitate lazy loading.

于 2018-06-20T18:10:57.280 回答
1

It's totally up to you and your requirement.

If the project is really big and has a number of sub-modules init. You can create multiple routing files (per routing file for the single module).

You can keep single routing file as well.

于 2018-06-20T18:07:02.970 回答