Answer the question
In order to leave comments, you need to log in
How deep can modularity go and what is the best way to organize it in angular?
I started using angular in conjunction with a stranger, at first I made one big module, two files, controllers and services, and that bunch of controllers and a bunch of services. then, quietly, the services were reduced to one and a handful of controllers, and then I also began to try sites on angular where each page is a module and it all connects in a big one, I tried to consider the modules projecting onto the database, i.e. user, userntrl, user service, etc. , then I connected the request, I’m sure that this is all baby talk and there is some kind of well-established good practice, please tell us about it from personal experience and drop links
Answer the question
In order to leave comments, you need to log in
Angular assumes that all modules used in your application are already loaded into memory before the application starts running. Those. no delayed loading.
There is a method that allows you to add services, controllers, etc. (but not modules) after the application starts, but this method cannot do lazy loading of the module, and then it turns out that you can only divide into modules what you can load immediately before the application starts. - www.sagarganatra.com/2014/08/lazy-loading-angularj...
There is a method that allows lazy adding and loading modules to an application module, but it is in beta and looks more like a crutch than a complete solution. - https://github.com/ocombe/ocLazyLoad
My personal experience (after some trial and error) is that I divide all the functional blocks of the application into modules and do a delayed full load of the necessary modules when I go to the desired section (without require)
It turns out that the module is:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question