typescript - Angular 2 Project Structure With Multiple Modules -
i'm developing first angular 2+ application , i'm running couple issues regarding how best structure application.
i've begun developing area of application user can things log in, , create account. these 2 routes, have several components (login form, signup form, login page, signup page, etc). continuing declare these in root module seems messy, application grows in size.
how should proceed going forward? make module each route? make 1 module encompasses both login , signup functionality since they're similar? i'm not finding online guidance great!
thank you!
the official style guide suggested @brijmcq , documentation modules give first orientation.
you should group application's classes in modules feature (and definetly not type). depends on context draw line. small application 1 root app module might sufficient, in cases having feature modules makes lot of sense. typically, module handles more 1 route, there might cases though, 1 route per module appropriate. in case, authentication module handles login, logout, registration,... sounds reasonable me. if registration process becomes complex, might consider refactoring own module @ later point.
some things might not belong 1 feature in particular used in several different features (mostly ui components, floating action button). it's common practice move own common module , import in modules.
Comments
Post a Comment