D
D
Drm2015-11-03 15:24:27
Angular
Drm, 2015-11-03 15:24:27

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', [ ])

Accordingly, I want to understand the validity of the second approach, since I like the first one much more, due to the fact that I don’t have to worry about dependencies and there are no cross dependencies, or am I not understanding something?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2015-11-03
@Drm

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 question

Ask a Question

731 491 924 answers to any question