You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adev/src/content/tools/libraries/creating-libraries.md
+3-4Lines changed: 3 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ It is also an excellent indication to consumers of the registry to differentiate
29
29
30
30
</docs-callout>
31
31
32
-
The `ng generate` command creates the `projects/my-lib` folder in your workspace, which contains a component and a service inside an NgModule.
32
+
The `ng generate` command creates the `projects/my-lib` folder in your workspace, which contains a component.
33
33
34
34
HELPFUL: For more details on how a library project is structured, refer to the [Library project files](reference/configs/file-structure#library-project-files) section of the [Project File Structure guide](reference/configs/file-structure).
35
35
@@ -69,11 +69,10 @@ This builder, among other things, ensures that the library is always built with
69
69
70
70
To make library code reusable you must define a public API for it.
71
71
This "user layer" defines what is available to consumers of your library.
72
-
A user of your library should be able to access public functionality \(such as NgModules, service providers and general utility functions\) through a single import path.
72
+
A user of your library should be able to access public functionality \(such as service providers and general utility functions\) through a single import path.
73
73
74
74
The public API for your library is maintained in the `public-api.ts` file in your library folder.
75
75
Anything exported from this file is made public when your library is imported into an application.
76
-
Use an NgModule to expose services and components.
77
76
78
77
Your library should supply documentation \(typically a README file\) for installation and maintenance.
79
78
@@ -100,7 +99,7 @@ Here are some things to consider in migrating application functionality to a lib
100
99
This practice lets the compiler leave the service out of the bundle if it never gets injected into the application that imports the library.
101
100
For more about this, see [Tree-shakable providers](guide/di/lightweight-injection-tokens).
102
101
103
-
* If you register global service providers or share providers across multiple NgModules, use the [`forRoot()`and `forChild()` design patterns](guide/ngmodules/singleton-services) provided by the [RouterModule](api/router/RouterModule)
102
+
* If you register global service providers expose a `provideXYZ()`provider function.
104
103
* If your library provides optional services that might not be used by all client applications, support proper tree-shaking for that case by using the [lightweight token design pattern](guide/di/lightweight-injection-tokens)
105
104
106
105
## Integrating with the CLI using code-generation schematics
0 commit comments