Angular libraries can come in different shapes and for different purposes!
utils — a collection of various utilities, usually in form of stateless services
component library — a collection of reusable simple (dumb) components with only plain API facilitated using mostly
drop in component — a more complex component with its own state handling / data fetching which can still communicate with the parent application using
@Output (eg pass in configuration or let the parent know about the outcome of some operation…)
sub-application — the most complex library which could also run as a stand alone application if the need be. Such a library can come with multiple modules with their own routes, components and services… List taken from this article
For short we need to use an injection token and a provider in the module definition of the lib and use forRoot in the consuming app.
How the modules of dist/library are available for all app without being a node module
Thanks to path additions of tsconfig.json added at the time of doing
ng generate library my-lib
This issue is not more valid from angular 9
Use an open source free private npm package
npm pack in dist/my-lib folder and npm install from this npm pack https://docs.npmjs.com/cli-commands/pack.html