Answer the question
In order to leave comments, you need to log in
What is the best way to build an application?
Good day, I have not written very large applications in Angular before, but now I have to write a large application with a large number of modules. Hence the question arose:
Previously, I declared the main module, the angular.module('app', [])
rest of the application, although they were in different files, were in fact part of this module (I did not create new modules).
The whole thing was assembled and minified through gulp and worked.
In various examples, I see a different practice, there is a main module, and each logical part of the application is pushed into a separate module and injected into the main one. It looks like this:
angular.module('app', ['module1', 'module2'])
...
angular.module('module1', [ ])
...
angular.module('module2', [ ])
Answer the question
In order to leave comments, you need to log in
Profit from many small modules in more flexible management of their dependencies. It is revealed during testing and if the project has an increasing number of dependencies (a common thing for large projects). In general, using stupid file cancatenation on large projects will no longer work. I recommend webpack (with less problems at the start).
https://github.com/angular-class/NG6-starter - try this approach. It suits the case with large applications well and is quite convenient (+ I hang out in gitter there). Also in angular 1.5, the angular.component helper will appear, which will simplify the whole thing a little more. Well, read the angular styleguide.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question