How to find out if it is normal to use an Angular2 module to import into a common module

Is there a litmus test to determine if the module is a supplier or exports other modules that are suppliers; to determine if a module is a candidate for inclusion in a “common” module?

From angular.io:

"SharedModule should not have suppliers for the reasons described earlier. Also, none of its imported or re-exported modules has suppliers. If you deviate from this guide, know what you are doing and why."

https://angular.io/docs/ts/latest/cookbook/ngmodule-faq.html#!#q-module-recommendations

However, if I move on to using a module, say, ReactiveFormsModule or RoutingModule, how can I determine if this test passes as described above? If I only use modules in a SharedModule that do not have suppliers or imported modules that re-export suppliers, then of course there must be some way to tell if the module meets this requirement. What is it?

+4
source share
2 answers

Services are typically intended for use in singleton applications.

, , , -. , , . , SharedModule, , .

. Core ( AppModule), Core Singleton.

:

, Singleton Services , SharedModule, SharedModules . CoreModules, AppModule.

:

  • AppModule .
  • AppModules
  • AppModule
  • ( AppModule)
+2

, .

enter image description here

providers[] , , AppModule.

+1

Source: https://habr.com/ru/post/1672640/


All Articles