Reputation:
With the following command I generated a library named (cac-common
)
ng generate library cac-common
In this library I have 2 modules:
cac-common-utility (ng generate module cac-common-utility --project=cac-common)
cac-common-security (ng generate module cac-common-security --project=cac-common)
When I want to use the cac-common-security
module I have to import it in any module as below:
import { CacCommonSecurityModule } from 'cac-common';
...
imports:[ CacCommonSecurityModule ]
...
My question are:
1- the import above load the whole cac-common library or load only cac-common-security module ?
2- why I can not import the cac-common-security module like the following ?
import { CacCommonSecurityModule } from 'cac-common/lib/cac-common-security/cac-common-security.module';
Upvotes: 0
Views: 328
Reputation: 7811
You Can use Library by Importing its modules.
Or importing a name that wrap and export all the modules in it.
If you import modules via relative path of its directory, the source of library always must be available. if you import by exported name, you can easily install it everywhere you want.
Upvotes: 1